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}