summaryrefslogtreecommitdiff
path: root/bin
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 /bin
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).
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pm_test5
-rwxr-xr-xbin/sleep_time_check12
2 files changed, 13 insertions, 4 deletions
diff --git a/bin/pm_test b/bin/pm_test
index 167487cd..14116eb7 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 d392769d..87fce153 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: