summaryrefslogtreecommitdiff
diff options
authorPierre Equoy <pierre.equoy@canonical.com>2015-10-01 15:12:33 +0800
committerPierre Equoy <pierre.equoy@canonical.com>2015-10-01 15:12:33 +0800
commit792f37967983822cf4270d3fe0adb9b3664eee43 (patch)
tree26ddac6806b340b61d1cb3f0a13f6e761b187e37
parenta9e69504678f6234954e9addc2afce1babe0a1a1 (diff)
Add support for '30 suspends + 1 reboot' cycle
Add the following jobs: - power-management/suspend-30-cycles-log-check-with-reboots - power-management/suspend-30-cycle-log-attach-with-reboots - power-management/suspend-30-cycles-time-check-with-reboots Modifies the `pm_test` script to include `sleep_test` output in its logs in order to easily access the data needed by `sleep_time_check` to compute average times. `sleep_time_check` has been updated to take into account more than one sleep/resume times (the mean value is computed and returned).
-rwxr-xr-xbin/pm_test5
-rwxr-xr-xbin/sleep_time_check12
-rw-r--r--jobs/stress.txt.in29
3 files changed, 41 insertions, 5 deletions
diff --git a/bin/pm_test b/bin/pm_test
index 167487c..14116eb 100755
--- a/bin/pm_test
+++ b/bin/pm_test
@@ -163,7 +163,10 @@ class PowerManagementOperation(object):
sleep_test_path, cycles_count)
logging.info('Running suspend/resume cycles')
logging.debug('Executing: {0!r}...'.format(command_str))
- subprocess.check_call(command_str, shell=True)
+ # We call sleep_test script and log its output as it contains
+ # average times we need to compute global average times later.
+ logging.info(subprocess.check_output(command_str,
+ universal_newlines=True, shell=True))
def summary(self):
"""
diff --git a/bin/sleep_time_check b/bin/sleep_time_check
index d392769..87fce15 100755
--- a/bin/sleep_time_check
+++ b/bin/sleep_time_check
@@ -2,6 +2,7 @@
import sys
import argparse
+from statistics import mean
def main():
@@ -35,20 +36,25 @@ def main():
return False
sleep_time = None
+ sleep_times = []
resume_time = None
+ resume_times = []
# find our times
for line in lines:
if "Average time to sleep" in line:
sleep_time = float(line.split(':')[1].strip())
+ sleep_times.append(sleep_time)
elif "Average time to resume" in line:
resume_time = float(line.split(':')[1].strip())
+ resume_times.append(resume_time)
- if sleep_time is None or resume_time is None:
+ if (sleep_time is None or resume_time is None) or \
+ (len(sleep_times) != len(resume_times)):
print("ERROR: One or more times was not reported correctly")
return False
- print("Average time to enter sleep state: %s seconds" % sleep_time)
- print("Average time to resume from sleep state: %s seconds" % resume_time)
+ print("Average time to enter sleep state: %.4f seconds" % mean(sleep_times))
+ print("Average time to resume from sleep state: %.4f seconds" % mean(resume_times))
failed = False
if sleep_time > args.sleep_threshold:
diff --git a/jobs/stress.txt.in b/jobs/stress.txt.in
index 0b12618..64b064f 100644
--- a/jobs/stress.txt.in
+++ b/jobs/stress.txt.in
@@ -90,7 +90,16 @@ depends: power-management/suspend_30_cycles
estimated_duration: 1.0
command: [ -e $PLAINBOX_SESSION_SHARE/suspend_30_cycles.log ] && sleep_test_log_check -v s3 $PLAINBOX_SESSION_SHARE/suspend_30_cycles.log
_description:
- Automated check of the 30 cycle hibernate log for errors detected by fwts.
+ Automated check of the 30 cycle suspend log for errors detected by fwts.
+
+plugin: shell
+category_id: 2013.com.canonical.plainbox::stress
+id: power-management/suspend-30-cycles-log-check-with-reboots
+depends: power-management/suspend_30_cycles_with_reboots
+estimated_duration: 1.0
+command: [ -e $PLAINBOX_SESSION_SHARE/pm_test.reboot.3.log ] && sleep_test_log_check -v s3 $PLAINBOX_SESSION_SHARE/pm_test.reboot.3.log
+_description:
+ Automated check of the '30 cycle suspend and 1 reboot times 3' logs for errors detected by fwts.
plugin: attachment
category_id: 2013.com.canonical.plainbox::stress
@@ -101,6 +110,15 @@ command: [ -e $PLAINBOX_SESSION_SHARE/suspend_30_cycles.log ] && cat $PLAINBOX_S
_description:
Attaches the log from the 30 cycle Suspend/Resume test if it exists
+plugin: attachment
+category_id: 2013.com.canonical.plainbox::stress
+id: power-management/suspend-30-cycle-log-attach-with-reboots
+estimated_duration: 1.0
+depends: power-management/suspend_30_cycles_with_reboots
+command: [ -e $PLAINBOX_SESSION_SHARE/pm_test.reboot.3.log ] && cat $PLAINBOX_SESSION_SHARE/pm_test.reboot.3.log
+_description:
+ Attaches the log from the '30 cycle Suspend/Resume and one reboot times 3' test if it exists
+
plugin: shell
category_id: 2013.com.canonical.plainbox::stress
id: power-management/suspend-30-cycles-time-check
@@ -112,6 +130,15 @@ _description:
plugin: shell
category_id: 2013.com.canonical.plainbox::stress
+id: power-management/suspend-30-cycles-time-check-with-reboots
+estimated_duration: 1.0
+depends: power-management/suspend_30_cycles_with_reboots
+command: [ -e $PLAINBOX_SESSION_SHARE/pm_test.reboot.3.log ] && sleep_time_check $PLAINBOX_SESSION_SHARE/pm_test.reboot.3.log
+_description:
+ Checks the sleep times to ensure that a machine suspends and resumes within a given threshold
+
+plugin: shell
+category_id: 2013.com.canonical.plainbox::stress
id: stress/hibernate_250_cycles
estimated_duration: 43400.0
depends: power-management/rtc