Changes to SOL Logging.
Removed dependency on ${LOG_TIME}.
Ensure only 1 obmc-console-client started by
"Start SOL Console Logging" is running.
Change-Id: Ic50b39479d7f1b745f4f2983535905d9e09c403f
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index cfcbd8f..7cb0ad7 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -302,63 +302,49 @@
Set Global Variable ${dbuscmd} ${cmd}
+Stop OBMC Console Client
+ [Documentation] Stop any running obmc_console_client
+ ... writing to file_path.
+ [Arguments] ${file_path}=/tmp/obmc-console.log
+
+ ${pid}=
+ ... Execute Command
+ ... ps ax | grep obmc-console-client | grep ${file_path} | grep -v grep | awk '{print $1}'
+
+ Run Keyword If '${pid}' != '${EMPTY}'
+ ... Execute Command kill -s KILL ${pid}
+ ... ELSE Log "No obmc-console-client process running"
+
+
Start SOL Console Logging
- [Documentation] Start logging to a file in /tmp so that it can
- ... be read by any other test cases. Stop existing
- ... running client processes if there is any.
- ... By default logging at /tmp/obmc-console.log else
- ... user input location.
- ... The File is appended with datetime and pid of
- ... process which created this log file.
- [Arguments] ${file_path}=/tmp/obmc-console.log
+ [Documentation] Start a new obmc_console_client process and direct
+ ... output to a file.
+ [Arguments] ${file_path}=/tmp/obmc-console.log
Open Connection And Log In
- ${cur_time}= Get Time Stamp
- Set Global Variable ${LOG_TIME} ${cur_time}
+ Stop OBMC Console Client ${file_path}
+
Start Command
- ... obmc-console-client > ${file_path}-${LOG_TIME}_$$
+ ... obmc-console-client > ${file_path}
Stop SOL Console Logging
- [Documentation] Login to BMC and Stop the obmc-console-client process.
- ... Find the pids from the log to filter the one started by
- ... specific test datetime and stop that process only.
- ... Ignore if there is no process running and return message
- ... "No obmc-console-client process running"
- ... By default retrieving log from /tmp/obmc-console.log else
- ... user input location.
- [Arguments] ${file_path}=/tmp/obmc-console.log
+ [Documentation] Stop obmc_console_client process, if any, and
+ ... return the console output as a string.
+ [Arguments] ${file_path}=/tmp/obmc-console.log
Open Connection And Log In
- ${pid} ${stderr}=
- ... Execute Command
- ... ls ${file_path}-${LOG_TIME}_* | cut -d'_' -f 2
- ... return_stderr=True
- Should Be Empty ${stderr}
-
- ${rc}=
- ... Execute Command
- ... ps ax | grep ${pid} | grep -v grep
- ... return_stdout=False return_rc=True
-
- Return From Keyword If '${rc}' == '${1}'
- ... No obmc-console-client process running
-
- ${console} ${stderr}=
- ... Execute Command kill -s KILL ${pid}
- ... return_stderr=True
- Should Be Empty ${stderr}
- Log Current Client PID:${pid}
+ Stop OBMC Console Client ${file_path}
${console} ${stderr}=
... Execute Command
- ... cat ${file_path}-${LOG_TIME}_${pid}
+ ... cat ${file_path}
... return_stderr=True
- Should Be Empty ${stderr}
+ Should Be Empty ${stderr}
- [Return] ${console}
+ [Return] ${console}
Get Time Stamp