summaryrefslogtreecommitdiff
diff options
authorPMR <pmr@pmr-lander>2018-06-28 09:50:51 +0000
committerPMR <pmr@pmr-lander>2018-06-28 09:50:51 +0000
commit6392745efbe2b708fe7a9fdbedb530f321841894 (patch)
tree628609704dd7f9b99f71297bb5785afcbadeece9
parent632b00a490a6cedb4f7bddb17482354064bc5b6f (diff)
parent8b806230824da712e11eb2fecd10acac8439d3e2 (diff)
Merge #348631 from ~kissiel/plainbox-provider-checkbox:fix-1743724-use-result-in-pmtest
-rwxr-xr-xbin/pm_test24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/pm_test b/bin/pm_test
index 8645907..70cd121 100755
--- a/bin/pm_test
+++ b/bin/pm_test
@@ -4,6 +4,7 @@ If you're debugging this program, set PM_TEST_DRY_RUN in your environment.
It will make the script not run actual S3, S4, reboot and poweroff commands.
"""
import gi
+import json
import logging
import logging.handlers
import os
@@ -222,6 +223,29 @@ 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.silent:
logging.info(message)
else: