summaryrefslogtreecommitdiff
path: root/bin
diff options
authorMaciej Kisielewski <maciej.kisielewski@canonical.com>2015-08-05 13:24:14 +0200
committerMaciej Kisielewski <maciej.kisielewski@canonical.com>2015-08-05 13:24:14 +0200
commit3ea094fc8ed722bbc0e40cc79e23d38c51078278 (patch)
treee6fc97ae9052df4b997b91793c6e041990541ebb /bin
parent7a5b5b38bf1fc0aff567ba64e0d588efb1c24152 (diff)
providers:checkbox: use suspend logic in pm_test
Signed-off-by: Maciej Kisielewski <maciej.kisielewski@canonical.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pm_test13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/pm_test b/bin/pm_test
index c9cfd4b..7c61491 100755
--- a/bin/pm_test
+++ b/bin/pm_test
@@ -91,6 +91,7 @@ class PowerManagementOperation(object):
self.check_last_cycle_duration()
if self.args.repetitions > 0:
+ self.run_suspend_cycles(self.args.suspends_before_reboot)
self.run_pm_command()
else:
self.summary()
@@ -150,6 +151,18 @@ class PowerManagementOperation(object):
subprocess.check_call(command_str, shell=True)
signal.pause()
+ def run_suspend_cycles(self, cycles_count):
+ """Run suspend and resume cycles."""
+ if cycles_count < 1:
+ return
+ sleep_test_path = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)), 'sleep_test')
+ command_str = '{} -s mem -p -i {} -w 10'.format(
+ 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)
+
def summary(self):
"""
Gather hardware information for the last time,