diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pm_test | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/bin/pm_test b/bin/pm_test index 14116eb..c2e0efb 100755 --- a/bin/pm_test +++ b/bin/pm_test @@ -88,38 +88,18 @@ class PowerManagementOperation(object): """ logging.info('{0} operations remaining: {1}' .format(self.args.pm_operation, self.args.repetitions)) - - 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() - - def check_last_cycle_duration(self): - """ - Make sure that last cycle duration was reasonable, - that is, not too short, not too long - """ - min_pm_time = timedelta(seconds=self.args.min_pm_time) - # add time needed for suspend/resume cycles ( < 100s each) - max_pm_time = timedelta(seconds=self.args.max_pm_time + - self.args.suspends_before_reboot * 100) if self.args.pm_timestamp: pm_timestamp = datetime.fromtimestamp(self.args.pm_timestamp) now = datetime.now() pm_time = now - pm_timestamp - if pm_time < min_pm_time: - raise TestFailed('{0} time less than expected: {1} < {2}' - .format(self.args.pm_operation.capitalize(), - pm_time, min_pm_time)) - if pm_time > max_pm_time: - raise TestFailed('{0} time greater than expected: {1} > {2}' - .format(self.args.pm_operation.capitalize(), - pm_time, max_pm_time)) - logging.info('{0} time: {1}' .format(self.args.pm_operation.capitalize(), pm_time)) + if self.args.repetitions > 0: + self.run_suspend_cycles(self.args.suspends_before_reboot, + self.args.fwts) + self.run_pm_command() + else: + self.summary() def run_pm_command(self): """ @@ -153,14 +133,19 @@ class PowerManagementOperation(object): subprocess.check_call(command_str, shell=True) signal.pause() - def run_suspend_cycles(self, cycles_count): + def run_suspend_cycles(self, cycles_count, fwts): """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) + if fwts: + script_name = 'fwts_test' + command_tpl = '{} -s s3 --s3-sleep-delay=30 --s3-multiple={}' + else: + script_name = 'sleep_test' + command_tpl = '{} -s mem -p -i {} -w 10' + script_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), script_name) + command_str = command_tpl.format(script_path, cycles_count) logging.info('Running suspend/resume cycles') logging.debug('Executing: {0!r}...'.format(command_str)) # We call sleep_test script and log its output as it contains @@ -620,7 +605,7 @@ class AutoStartFile(object): [Desktop Entry] Name={pm_operation} test Comment=Verify {pm_operation} works properly -Exec=sudo /usr/bin/python3 {script} -r {repetitions} -w {wakeup} --hardware-delay {hardware_delay} --pm-delay {pm_delay} --min-pm-time {min_pm_time} --max-pm-time {max_pm_time} --append --total {total} --start {start} --pm-timestamp {pm_timestamp} {silent} --log-level={log_level} --log-dir={log_dir} --suspends-before-reboot={suspend_cycles} {pm_operation} +Exec=sudo /usr/bin/python3 {script} -r {repetitions} -w {wakeup} --hardware-delay {hardware_delay} --pm-delay {pm_delay} --min-pm-time {min_pm_time} --max-pm-time {max_pm_time} --append --total {total} --start {start} --pm-timestamp {pm_timestamp} {silent} --log-level={log_level} --log-dir={log_dir} --suspends-before-reboot={suspend_cycles} {fwts} {pm_operation} Type=Application X-GNOME-Autostart-enabled=true Hidden=false @@ -671,6 +656,7 @@ Hidden=false silent='--silent' if self.args.silent else '', log_level=self.args.log_level_str, log_dir=self.args.log_dir, + fwts='--fwts' if self.args.fwts else '', suspend_cycles=self.args.suspends_before_reboot, pm_operation=self.args.pm_operation)) logging.debug(contents) @@ -806,6 +792,10 @@ class MyArgumentParser(object): parser.add_argument('--suspends-before-reboot', type=int, default=0, help=('How many cycles of suspend/resume to run' 'before each reboot or poweroff')) + + # use fwts for suspend tests + parser.add_argument('--fwts', action='store_true', help=('Use fwts ' + 'when doing the suspend tests')) self.parser = parser def parse(self): |