Collect FFDC on failure and error log existence.
1. Call generic FFDa collection if test fails.
2. Collect FFDC if test "PASS" but error log exist.
Resolves openbmc/openbmc-test-automation#905
Change-Id: I8e3accad57cdd5f8b40427aeffc4cb4368fbee42
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/code_update/bmc_code_update.robot b/extended/code_update/bmc_code_update.robot
index 76f2ef2..b462e1f 100644
--- a/extended/code_update/bmc_code_update.robot
+++ b/extended/code_update/bmc_code_update.robot
@@ -12,7 +12,7 @@
Resource ../../lib/openbmc_ffdc.robot
Resource ../../lib/dump_utils.robot
-Test Teardown FFDC On Test Case Fail
+Test Teardown Code Update Test Teardown
*** Variables ***
@@ -62,3 +62,11 @@
# - Clean up all existing BMC dumps.
Delete All Dumps
+
+Code Update Test Teardown
+ [Documentation] Do code update test case teardown.
+ # 1. Collect FFDC if test case failed.
+ # 2. Collect FFDC if test PASS but error log exists.
+
+ FFDC On Test Case Fail
+ Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC
diff --git a/extended/code_update/host_code_update.robot b/extended/code_update/host_code_update.robot
index 3e388ec..799e38f 100644
--- a/extended/code_update/host_code_update.robot
+++ b/extended/code_update/host_code_update.robot
@@ -24,7 +24,7 @@
Resource ../../lib/state_manager.robot
Resource ../../lib/dump_utils.robot
-Test Teardown FFDC On Test Case Fail
+Test Teardown Code Update Test Teardown
*** Variables ***
@@ -37,6 +37,10 @@
REST Host Code Update
[Documentation] Do a PNOR code update by uploading image on BMC via REST.
+ # 1. Delete error logs if there is any.
+ # 1. Do code update.
+ # 2. Do post update the following:
+ # - Collect FFDC if error log exist and delete error logs.
[Tags] REST_Host_Code_Update
[Setup] Code Update Setup
@@ -44,6 +48,7 @@
OBMC Reboot (off)
+
Post Update Boot To OS
[Documentation] Boot the host OS
[Tags] Post_Update_Boot_To_OS
@@ -52,6 +57,7 @@
Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
... Fail Code update failed. No need to boot to OS.
Start SOL Console Logging
+ Delete Error Logs
REST Power On
@@ -147,6 +153,7 @@
# - Clean up all currently install PNOR images.
Delete All Dumps
+ Delete Error Logs
Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}'
... Delete All PNOR Images
@@ -168,3 +175,12 @@
${version}= BMC Execute Command
... grep extended_version= ${manifest_path}
[return] ${version.split(",")}
+
+
+Code Update Test Teardown
+ [Documentation] Do code update test case teardown.
+ # 1. Collect FFDC if test case failed.
+ # 2. Collect FFDC if test PASS but error log exists.
+
+ FFDC On Test Case Fail
+ Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC
diff --git a/lib/code_update_utils.robot b/lib/code_update_utils.robot
index ebb48a3..03c6d3f 100644
--- a/lib/code_update_utils.robot
+++ b/lib/code_update_utils.robot
@@ -6,6 +6,7 @@
Library String
Variables ../data/variables.py
Resource rest_client.robot
+Resource openbmc_ffdc.robot
*** Keywords ***
@@ -183,3 +184,11 @@
${image_id}= Fetch From Right ${software_object} /
BMC Execute Command
... [ ! -d "/tmp/images/${image_id}" ]
+
+
+Check Error And Collect FFDC
+ [Documentation] Collect FFDC if error log exists.
+
+ ${status}= Run Keyword And Return Status Error Logs Should Not Exist
+ Run Keyword If '${status}' == 'False' FFDC
+ Delete Error Logs