Fix "Execute Command and Write FFDC" to handle quotes in stderr.
In "Execute Command and Write FFDC":
- Fix stderr check to handle stderr text containing single quotes.
- Change to include stdout when writing error data to logpath.
- Made a few changes to comply with team standards.
Change-Id: I66b4d05cbc5a424b96bfefb94fe35b90ac050c3b
Signed-off-by: Jeff Whitlock <v2aic232@us.ibm.com>
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index 0dd8e62..663f56b 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -80,10 +80,12 @@
${stdout} ${stderr}=
... Execute Command ${cmd} return_stderr=True
- # Write stdout data on success and error msg to the file on failure
- Run Keyword If '${stderr}' == '${EMPTY}'
- ... Write Data to File ${stdout}${\n} ${logpath}
- ... ELSE Run Keyword Write Data to File ${stderr}${\n} ${logpath}
+ # Write stdout on success and stderr/stdout to the file on failure.
+ Run Keyword If $stderr == '${EMPTY}'
+ ... Write Data to File ${stdout}${\n} ${logpath}
+ ... ELSE Write Data to File
+ ... ERROR output:${\n}${stderr}${\n}Output:${\n}${stdout}${\n}
+ ... ${logpath}
################################################################
@@ -118,11 +120,11 @@
################################################################
Log Test Case Status
- [Documentation] Test case execution result history.
- ... Create once and append to this file
- ... logs/test_history.txt
- ... Format Date:Test suite:Test case:Status
- ... 20160909214053719992:Test Warmreset:Test WarmReset via REST:FAIL
+ [Documentation] Test case execution result history.
+ ... Create once and append to this file
+ ... logs/test_history.txt
+ ... Format Date:Test suite:Test case:Status
+ ... 20160909214053719992:Test Warmreset:Test WarmReset via REST:FAIL
Create Directory ${FFDC_LOG_PATH}
${exist}= Run Keyword and Return Status
@@ -219,8 +221,9 @@
... . /etc/os-release; echo $ID
... return_stdout=True return_stderr=False return_rc=False
- Return From Keyword If '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None'
- ... Could not determine Linux Distribution
+ Return From Keyword If
+ ... '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None'
+ ... Could not determine Linux Distribution
@{entries}= Get ffdc os distro index ${linux_distro}
:FOR ${index} IN @{entries}