File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,22 @@ def main(args=sys.argv[1:]):
6767 str (args .sleep_delay ),
6868 ]
6969 suspend_cmd = ["systemctl" , "suspend" ]
70+ list_jobs_cmd = ["systemctl" , "list-jobs" , "*suspend*" ]
71+ timeout = 10
72+ while timeout > 0 :
73+ output = subprocess .check_output (
74+ list_jobs_cmd ,
75+ stderr = subprocess .STDOUT ,
76+ universal_newlines = True ,
77+ ).strip ()
78+ if "No jobs running." in output or "No jobs listed." in output :
79+ break
80+ print ("Suspend jobs ongoing, waiting..." )
81+ time .sleep (1 )
82+ timeout -= 1
83+ else :
84+ print ("Timed out waiting for suspend jobs to finish" )
85+ return 1
7086 print ("Running: {}" .format (" " .join (rtcwake_cmd )))
7187 subprocess .check_call (rtcwake_cmd )
7288 print (
@@ -80,6 +96,8 @@ def main(args=sys.argv[1:]):
8096 print ("Removing {}..." .format (log_path ))
8197 os .remove (log_path )
8298
99+ return 0
100+
83101
84102if __name__ == "__main__" :
85103 sys .exit (main ())
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ estimated_duration: 75.0
7979environ: PLAINBOX_SESSION_SHARE STRESS_S3_INIT_DELAY STRESS_S3_SLEEP_DELAY STRESS_S3_WAIT_DELAY LD_LIBRARY_PATH RTC_DEVICE_FILE
8080user: root
8181command:
82+ set -o pipefail
8283 echo "Current boot ID is: $(tr -d - < /proc/sys/kernel/random/boot_id)"
8384 suspend_trigger.py --wait "${STRESS_S3_INIT_DELAY:-120}" --check-delay "${STRESS_S3_WAIT_DELAY:-45}" --sleep-delay "${STRESS_S3_SLEEP_DELAY:-30}" --rtc-device "${RTC_DEVICE_FILE:-/dev/rtc0}" 2>&1 | tee -a "$PLAINBOX_SESSION_SHARE"/suspend_cycles_with_reboot_total.log
8485summary:
@@ -105,6 +106,7 @@ environ: PLAINBOX_SESSION_SHARE STRESS_S3_INIT_DELAY STRESS_S3_SLEEP_DELAY STRES
105106after: stress-tests/suspend_cycles_reboot{{suspend_reboot_previous}}
106107user: root
107108command:
109+ set -o pipefail
108110 echo "Current boot ID is: $(tr -d - < /proc/sys/kernel/random/boot_id)"
109111 suspend_trigger.py --wait "${STRESS_S3_INIT_DELAY:-120}" --check-delay "${STRESS_S3_WAIT_DELAY:-45}" --sleep-delay "${STRESS_S3_SLEEP_DELAY:-30}" --rtc-device "${RTC_DEVICE_FILE:-/dev/rtc0}" 2>&1 | tee -a "$PLAINBOX_SESSION_SHARE"/suspend_cycles_with_reboot_total.log
110112summary:
@@ -129,6 +131,7 @@ environ: PLAINBOX_SESSION_SHARE STRESS_S3_INIT_DELAY STRESS_S3_SLEEP_DELAY STRES
129131after: stress-tests/suspend_cycles_{{suspend_id_previous}}_reboot{{suspend_reboot_id}}
130132user: root
131133command:
134+ set -o pipefail
132135 echo "Current boot ID is: $(tr -d - < /proc/sys/kernel/random/boot_id)"
133136 suspend_trigger.py --check-delay "${STRESS_S3_WAIT_DELAY:-45}" --sleep-delay "${STRESS_S3_SLEEP_DELAY:-30}" --rtc-device "${RTC_DEVICE_FILE:-/dev/rtc0}" 2>&1 | tee -a "$PLAINBOX_SESSION_SHARE"/suspend_cycles_with_reboot_total.log
134137summary:
You can’t perform that action at this time.
0 commit comments