summaryrefslogtreecommitdiff
path: root/bin
diff options
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pm_test46
1 files changed, 24 insertions, 22 deletions
diff --git a/bin/pm_test b/bin/pm_test
index 70cd1213..86bf2d96 100755
--- a/bin/pm_test
+++ b/bin/pm_test
@@ -223,28 +223,30 @@ class PowerManagementOperation():
message = ('{0} test complete'
.format(self.args.pm_operation.capitalize()))
- total_suspends_expected = (
- self.args.suspends_before_reboot * self.args.total)
- problems = ''
- fwts_log_path = os.path.join(self.args.log_dir, 'fwts.log')
- try:
- with open(fwts_log_path, 'rt') as f:
- magic_line = 'Completed S3 cycle(s) \n'
- count = f.readlines().count(magic_line)
- if count != total_suspends_expected:
- problems = (
- "Found {} occurrences of '{}'. Expected {}".format(
- count, magic_line.strip(),
- total_suspends_expected))
- except FileNotFoundError:
- problems = "Error opening {}".format(fwts_log_path)
- if problems:
- result = {
- 'outcome': 'fail' if problems else 'pass',
- 'comment': problems,
- }
- with open(os.path.join(self.args.log_dir, '__result'), 'wt') as f:
- json.dump(result, f)
+ if self.args.suspends_before_reboot:
+ total_suspends_expected = (
+ self.args.suspends_before_reboot * self.args.total)
+ problems = ''
+ fwts_log_path = os.path.join(self.args.log_dir, 'fwts.log')
+ try:
+ with open(fwts_log_path, 'rt') as f:
+ magic_line = 'Completed S3 cycle(s) \n'
+ count = f.readlines().count(magic_line)
+ if count != total_suspends_expected:
+ problems = (
+ "Found {} occurrences of '{}'. Expected {}".format(
+ count, magic_line.strip(),
+ total_suspends_expected))
+ except FileNotFoundError:
+ problems = "Error opening {}".format(fwts_log_path)
+ if problems:
+ result = {
+ 'outcome': 'fail' if problems else 'pass',
+ 'comment': problems,
+ }
+ result_filename = os.path.join(self.args.log_dir, '__result')
+ with open(result_filename, 'wt') as f:
+ json.dump(result, f)
if self.args.silent:
logging.info(message)