Add skip error option for journald log checking
Usage:
Single string pattern option usage:
-v SKIP_ERROR:'core-dump'
Multiple string pattern "\|" separated option usage:
-v SKIP_ERROR:'core-dump/Failed to start OpenPOWER OCC'
Change-Id: If79827cd2ff84c50512b57e090d3a93a90a80b9e
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/common_utils.robot b/lib/common_utils.robot
index 6c19021..3c3d8e4 100755
--- a/lib/common_utils.robot
+++ b/lib/common_utils.robot
@@ -932,15 +932,22 @@
Check For Regex In Journald
[Documentation] Parse the journal log and check for regex string.
[Arguments] ${regex}=${ERROR_REGEX} ${error_check}=${0} ${boot}=${EMPTY}
+ ... ${filter_string}=${EMPTY}
# Description of argument(s):
# regex Strings to be filter.
# error_check Check for errors.
# boot Argument to check current or persistent full boot log
# (e.g. "-b").
+ # filter_string String to be stripped out.
- ${journal_log} ${stderr} ${rc}= BMC Execute Command
- ... journalctl --no-pager ${boot} | egrep '${regex}' ignore_err=1
+
+ ${cmd} = Run Keyword If '${filter_string}' == '${EMPTY}'
+ ... Catenate journalctl --no-pager ${boot} | egrep '${regex}'
+ ... ELSE
+ ... Catenate journalctl --no-pager ${boot} | egrep '${regex}' | sed '/${filter_string}/d'
+
+ ${journal_log} ${stderr} ${rc}= BMC Execute Command ${cmd} ignore_err=1
Run Keyword If ${error_check} == ${0}
... Should Be Empty ${journal_log}
diff --git a/redfish/extended/test_basic_ci.robot b/redfish/extended/test_basic_ci.robot
index 10a7c2e..f976e1f 100644
--- a/redfish/extended/test_basic_ci.robot
+++ b/redfish/extended/test_basic_ci.robot
@@ -18,6 +18,8 @@
${ERROR_REGEX} SEGV|core-dump|FAILURE|Failed to start
${STANDBY_REGEX} Startup finished in
+${SKIP_ERROR} ${EMPTY}
+
# 3 minutes standby boot time.
${startup_time_threshold} 180
@@ -58,7 +60,7 @@
[Documentation] Parse the journal log and check for failures.
[Tags] Check_For_Application_Failures
- Check For Regex In Journald ${ERROR_REGEX} error_check=${0} boot=-b
+ Check For Regex In Journald ${ERROR_REGEX} error_check=${0} boot=-b filter_string=${SKIP_ERROR}
Verify Uptime Average Against Threshold
diff --git a/redfish/test_xit.robot b/redfish/test_xit.robot
index caaf466..3c5f4b9 100644
--- a/redfish/test_xit.robot
+++ b/redfish/test_xit.robot
@@ -11,6 +11,7 @@
# Error strings to check from journald.
${ERROR_REGEX} SEGV|core-dump|FAILURE|Failed to start
+${SKIP_ERROR} ${EMPTY}
*** Test Cases ***
@@ -33,7 +34,7 @@
${rest_resp}= Run Keyword If '${resp.status}' == '${HTTP_NOT_FOUND}'
... Check For REST Dumps
- Check For Regex In Journald ${ERROR_REGEX} error_check=${0} boot=-b
+ Check For Regex In Journald ${ERROR_REGEX} error_check=${0} boot=-b filter_string=${SKIP_ERROR}
*** Keywords ***