[HTX] hardbootme timer countdown in the console
Add estimated time remaining to systest/htx_hardbootme_test.
Resolves openbmc/openbmc-test-automation#581
Change-Id: Ib7894bd21593dd432c4eaa5ebb42bfaa0a16e5c3
Signed-off-by: Steven Sombar <ssombar@us.ibm.com>
diff --git a/systest/htx_hardbootme_test.robot b/systest/htx_hardbootme_test.robot
index 343ffef..8dd89a1 100755
--- a/systest/htx_hardbootme_test.robot
+++ b/systest/htx_hardbootme_test.robot
@@ -7,23 +7,23 @@
# OS_HOST The OS host name or IP Address.
# OS_USERNAME The OS login userid (usually root).
# OS_PASSWORD The password for the OS login.
-# HTX_DURATION Duration of HTX run, for example, 8 hours, or
-# 30 minutes.
+# HTX_DURATION Duration of HTX run, for example, 2h, or 30m.
# HTX_LOOP The number of times to loop HTX.
# HTX_INTERVAL The time delay between consecutive checks of HTX
-# status, for example, 30s.
+# status, for example, 15m.
# In summary: Run HTX for $HTX_DURATION, looping
-# $HTX_LOOP times checking every $HTX_INTERVAL.
+# $HTX_LOOP times checking for errors every $HTX_INTERVAL.
+# Then allow extra time for OS Boot, HTX startup, shutdown.
# HTX_KEEP_RUNNING If set to 1, this indicates that the HTX is to
-# continue running after an error.
+# continue running after an error was found.
# CHECK_INVENTORY If set to 0 or False, OS inventory checking before
# and after each HTX run will be disabled. This
-# parameter is optional.
+# parameter is optional. The default value is True.
# PREV_INV_FILE_PATH The file path and name of an initial previous
# inventory snapshot file in JSON format. Inventory
# snapshots taken before and after each HTX run will
# be compared to this file.
-# This parameter is optional. If not specified, an
+# This parameter is optional. If not specified an
# initial inventory snapshot will be taken before
# HTX startup.
# INV_IGNORE_LIST A comma-delimited list of strings that
@@ -50,10 +50,9 @@
${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
${json_final_file_path} ${EXECDIR}/os_inventory_final.json
${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
-${last_inventory_file_path} ${EMPTY}
${CHECK_INVENTORY} True
${INV_IGNORE_LIST} size
-${PREV_INV_FILE_PATH} ${EMPTY}
+${PREV_INV_FILE_PATH} NONE
*** Test Cases ***
@@ -62,22 +61,32 @@
[Documentation] Stress the system using HTX exerciser.
[Tags] Hard_Bootme_Test
- # Set last inventory file to PREV_INV_FILE_PATH otherwise set it
- # to ${EMPTY}.
- ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH}
- ... ${EMPTY}
-
Rprintn
- Rpvars HTX_DURATION HTX_INTERVAL CHECK_INVENTORY INV_IGNORE_LIST
- ... PREV_INV_FILE_PATH
+ Rpvars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
+ ... INV_IGNORE_LIST PREV_INV_FILE_PATH
- Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
- ... OperatingSystem.File Should Exist ${last_inventory_file_path}
+ Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
+ ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH}
- Set Suite Variable ${last_inventory_file_path} children=true
+ Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Set Suite Variable ${INV_IGNORE_LIST} children=true
+
+ # Set up the iteration (loop) counter.
Set Suite Variable ${iteration} ${0} children=true
+ # Estimate the time required for a single iteration loop.
+ # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown.
+ ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m
+ Set Suite Variable ${loop_body_seconds} children=true
+ # And save it in printable (compact) format.
+ ${estimated_loop_time}= Convert Time
+ ... ${loop_body_seconds} result_format=compact
+ Set Suite Variable ${estimated_loop_time} children=true
+
+ # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m
+ ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60)
+ Set Suite Variable ${est_seconds_left} children=true
+
Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
@@ -100,7 +109,10 @@
Set Suite Variable ${iteration} ${iteration + 1}
${loop_count}= Catenate Starting iteration: ${iteration}
- Rpvars loop_count
+ ${estimated_time_remaining}= Convert Time
+ ... ${est_seconds_left} result_format=compact
+ Rprintn
+ Rpvars loop_count estimated_loop_time estimated_time_remaining
Boot To OS
@@ -109,7 +121,7 @@
Run Keyword If '${CHECK_INVENTORY}' == 'True'
... Do Inventory And Compare ${json_initial_file_path}
- ... ${last_inventory_file_path}
+ ... ${PREV_INV_FILE_PATH}
Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
... Create Default MDT Profile
@@ -122,7 +134,7 @@
Run Keyword If '${CHECK_INVENTORY}' == 'True'
... Do Inventory And Compare ${json_final_file_path}
- ... ${last_inventory_file_path}
+ ... ${PREV_INV_FILE_PATH}
Power Off Host
@@ -133,22 +145,28 @@
Rprint Timen HTX Test ran for: ${HTX_DURATION}
${loop_count}= Catenate Ending iteration: ${iteration}
- Rpvars loop_count
+
+ ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds}
+ Set Suite Variable ${est_seconds_left} children=true
+ ${estimated_time_remaining}= Convert Time
+ ... ${est_seconds_left} result_format=compact
+
+ Rpvars loop_count estimated_time_remaining
Do Inventory And Compare
[Documentation] Do inventory and compare.
- [Arguments] ${inventory_file_path} ${last_inventory_file_path}
+ [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH}
# Description of argument(s):
- # inventory_file_path The file to receive the inventory snapshot.
- # last_inventory_file_path The previous inventory to compare with.
+ # inventory_file_path The file to receive the inventory snapshot.
+ # PREV_INV_FILE_PATH The previous inventory to compare with.
Create JSON Inventory File ${inventory_file_path}
- Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
+ Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
... Compare Json Inventory Files ${inventory_file_path}
- ... ${last_inventory_file_path}
- ${last_inventory_file_path}= Set Variable ${inventory_file_path}
- Set Suite Variable ${last_inventory_file_path} children=true
+ ... ${PREV_INV_FILE_PATH}
+ ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path}
+ Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Compare Json Inventory Files