Core dump check introduction before and after code update.

This change addresses as follows:
     1. Core dump check introduction before and after code update
     2. Set core file size to unlimited after code update

Resolves openbmc/openbmc-test-automation#426

Change-Id: Iccaca5e6fc3c7a99b6758a0f44882fe816acc5e3
Signed-off-by: Sivas SRR <sivas.srr@in.ibm.com>
diff --git a/extended/code_update/update_bmc.robot b/extended/code_update/update_bmc.robot
index 4a55880..fb5f46b 100644
--- a/extended/code_update/update_bmc.robot
+++ b/extended/code_update/update_bmc.robot
@@ -48,6 +48,11 @@
     Check BMC Mem Performance
     Check BMC File System Performance
 
+Check Core Dump Exist Before Code Update
+    [Documentation]  Check core dump existence on BMC before code update.
+    [Tags]  Check_Core_Dump_Exist_Before_Code_Update
+    Check For Core Dumps
+
 Initiate Code Update BMC
     [Documentation]  BMC code update process initiation
     [Setup]  Set State Interface Version
@@ -109,7 +114,6 @@
     Run Keyword If  ${BOOT_COUNT} == ${1}
     ...  Log  Boot Time not Updated by Kernel!!!  level=WARN
 
-
 Test Basic BMC Performance At Ready State
     [Documentation]   Check performance of memory, CPU & file system of BMC.
     [Tags]  Test_Basic_BMC_Performance_At_Ready_State
@@ -118,6 +122,16 @@
     Check BMC Mem Performance
     Check BMC File System Performance
 
+Check Core Dump Exist After Code Update
+    [Documentation]  Check core dump existence on BMC after code update.
+    [Tags]  Check_Core_Dump_Exist_After_Code_Update
+    Check For Core Dumps
+
+Enable Core Dump File Size To Be Unlimited
+    [Documentation]  Set core dump file size to unlimited.
+    [Tags]  Enable_Core_Dump_File_size_To_Be_unlimited
+    Set Core Dump File Size Unlimited
+
 *** Keywords ***
 
 Check Boot Count And Time
diff --git a/lib/utils.robot b/lib/utils.robot
index a04bc58..487ef5d 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -761,6 +761,25 @@
     ...  echo '/tmp/core_%e.%p' | tee /proc/sys/kernel/core_pattern
     Should Be Equal As Strings  ${core_pattern}  /tmp/core_%e.%p
 
+Get Number Of BMC Core Dump Files
+    [Documentation]  Get number of core dump files on BMC.
+    Open Connection And Log In
+    ${num_of_core_dump}=  Execute Command
+    ...  ls /tmp/core* 2>/dev/null | wc -l
+    [Return]  ${num_of_core_dump}
+
+Set Core Dump File Size Unlimited
+    [Documentation]  Set core dump file size to unlimited.
+    Open Connection And Log In
+    Execute Command On BMC
+    ...  ulimit -c unlimited
+
+Check For Core Dumps
+    [Documentation]  Check for any core dumps exist.
+    ${output}=  Get Number Of BMC Core Dump Files
+    Run Keyword If  ${output} > 0
+    ...  Log  **Warning** BMC core dump files exist  level=WARN
+
 Trigger Host Watchdog Error
     [Documentation]  Inject host watchdog error using BMC.
     [Arguments]  ${milliseconds}=1000  ${sleep_time}=5s