Test boot count after BMC reboot.
This change includes:
- Added test case to check boot count after BMC reboot.
- Added keyword to get boot count based on bootime change.
- Added keyword to set boot count.
Resolve openbmc/openbmc-test-automation#352
Change-Id: I6b831c96cae188788fb2161a8cafddf15ac1b326
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 09f98f7..002b6d8 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -30,6 +30,7 @@
${BOOT_TIME} ${0}
${BOOT_COUNT} ${0}
+${count} ${0}
${devicetree_base} /sys/firmware/devicetree/base/model
*** Keywords ***
@@ -849,3 +850,28 @@
# Remove the tarball file from BMC
Execute Command On BMC rm /tmp/debug-tarball.tar.xz
+Get BMC Boot Count
+ [Documentation] Get BMC boot count based on boot time.
+ ${cur_btime}= Get BMC Boot Time
+
+ # Set global variable BOOT_TIME to current boot time if current boot time
+ # is changed. Also increase value of global variable BOOT_COUNT by 1.
+ Run Keyword If ${cur_btime} > ${BOOT_TIME}
+ ... Run Keywords Set Global Variable ${BOOT_TIME} ${cur_btime}
+ ... AND
+ ... Set Global Variable ${BOOT_COUNT} ${BOOT_COUNT + 1}
+ [Return] ${BOOT_COUNT}
+
+Set BMC Boot Count
+ [Documentation] Set BMC boot count to given value.
+ [Arguments] ${count}
+
+ # Description of arguments:
+ # count boot count value.
+ ${cur_btime}= Get BMC Boot Time
+
+ # Set global variable BOOT_COUNT to given value.
+ Set Global Variable ${BOOT_COUNT} ${count}
+
+ # Set BOOT_TIME variable to current boot time.
+ Set Global Variable ${BOOT_COUNT} ${count}
diff --git a/tests/test_general_bmc_system.robot b/tests/test_general_bmc_system.robot
new file mode 100755
index 0000000..3d50f49
--- /dev/null
+++ b/tests/test_general_bmc_system.robot
@@ -0,0 +1,29 @@
+*** Settings ***
+Documentation Basic BMC Linux kernel stability test.
+
+Resource ../lib/utils.robot
+Resource ../lib/connection_client.robot
+Resource ../lib/openbmc_ffdc.robot
+Resource ../lib/state_manager.robot
+
+Suite Setup Open Connection And Log In
+Suite Teardown Close All Connections
+
+# TODO: Collect proc data from system as part of FFDC
+# Refer openbmc/openbmc-test-automation#353
+Test Teardown FFDC On Test Case Fail
+
+*** Variables ***
+
+
+*** Test Cases ***
+
+Verify Boot Count After BMC Reboot
+ [Documentation] Verify boot count increments on BMC reboot.
+ [Tags] Verify_Boot_Count_After_BMC_Reboot
+
+ Set BMC Boot Count ${0}
+ Initiate BMC Reboot
+ ${boot_count}= Get BMC Boot Count
+ Should Be Equal ${boot_count} ${1}
+ ... msg=Boot count is not incremented.