Read uptime from journald footprint and verify
Resolves openbmc/openbmc-test-automation#1339
Change-Id: Ia25643c584c6e0a6092d6ef9d091bd967cb399df
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_basic_poweron.robot b/tests/test_basic_poweron.robot
index c690237..677bbc8 100644
--- a/tests/test_basic_poweron.robot
+++ b/tests/test_basic_poweron.robot
@@ -1,6 +1,8 @@
*** Settings ***
Documentation Test power on for HW CI.
+Library DateTime
+
Resource ../lib/openbmc_ffdc.robot
Resource ../lib/utils.robot
Resource ../lib/state_manager.robot
@@ -20,7 +22,11 @@
${LOOP_COUNT} ${2}
# Error strings to check from journald.
-${ERROR_REGEX} SEGV|core-dump
+${ERROR_REGEX} SEGV|core-dump
+${STANDBY_REGEX} Startup finished in
+
+# 3 minutes standby boot time.
+${startup_time_threshold} 180
*** Test Cases ***
@@ -53,9 +59,20 @@
[Tags] Verify_Uptime_Average_Against_Threshold
OBMC Reboot (off)
- ${uptime}= Measure BMC Boot Time
- Should Be True ${uptime} < 180
- ... msg=${uptime} exceeds threshold.
+
+ # Example output:
+ # Startup finished in 10.074s (kernel) + 2min 23.506s (userspace) = 2min 33.581s.
+ ${startup_time} ${stderr} ${rc}= BMC Execute Command
+ ... journalctl --no-pager | egrep '${STANDBY_REGEX}' | tail -1
+ Should Not Be Empty ${startup_time}
+
+ # Example time conversion:
+ # Get the "2min 33.581s" string total time taken to reach standby.
+ # Convert time "2min 33.581s" to unit 153.581.
+ ${startup_time}= Convert Time ${startup_time.split("= ",1)[1].strip(".")}
+
+ Should Be True ${startup_time} < ${startup_time_threshold}
+ ... msg=${startup_time} greater than threshold value of ${startup_time_threshold}.
Test SSH And IPMI Connections
[Documentation] Try SSH and IPMI commands to verify each connection.