Merge ~sylvain-pineau/checkbox-support:fwts_test_no_syslog_v2 into checkbox-support:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 00acbbb0c7887f40840ccc74da6b0a4bcd2935e2
Merged at revision: 7c0ec613d3e800a8a8f1e959456916cdb041ad84
Proposed branch: ~sylvain-pineau/checkbox-support:fwts_test_no_syslog_v2
Merge into: checkbox-support:master
Diff against target: 58 lines (+21/-12)
1 file modified
checkbox_support/scripts/fwts_test.py (+21/-12)
Reviewer Review Type Date Requested Status
Maciej Kisielewski Approve
Review via email: mp+354849@code.launchpad.net

Description of the change

Fix a bug when S3 timings are not available in logs:

==================== Test Results ====================
Traceback (most recent call last):
  File "/snap/checkbox-plano/188/bin/checkbox-support-fwts_test", line 11, in <module>
    load_entry_point('checkbox-support==0.39.0.dev0', 'console_scripts', 'checkbox-support-fwts_test')()
  File "/snap/checkbox-plano/188/lib/python3.5/site-packages/checkbox_support/scripts/fwts_test.py", line 269, in main
    % (iteration, iterations, suspend_time, resume_time))
TypeError: a float is required

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

Goodies! +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/checkbox_support/scripts/fwts_test.py b/checkbox_support/scripts/fwts_test.py
2index 3111217..f5cc00b 100644
3--- a/checkbox_support/scripts/fwts_test.py
4+++ b/checkbox_support/scripts/fwts_test.py
5@@ -75,14 +75,18 @@ def average_times(runs):
6 sleep_total = 0.0
7 resume_total = 0.0
8 run_count = 0
9- for run in runs.keys():
10- run_count += 1
11- sleep_total += runs[run][0]
12- resume_total += runs[run][1]
13- sleep_avg = sleep_total / run_count
14- resume_avg = resume_total / run_count
15- print('Average time to sleep: %0.5f' % sleep_avg)
16- print('Average time to resume: %0.5f' % resume_avg)
17+ try:
18+ for run in runs.keys():
19+ run_count += 1
20+ sleep_total += runs[run][0]
21+ resume_total += runs[run][1]
22+ sleep_avg = sleep_total / run_count
23+ resume_avg = resume_total / run_count
24+ print('Average time to sleep: %0.5f' % sleep_avg)
25+ print('Average time to resume: %0.5f' % resume_avg)
26+ except TypeError:
27+ print('Average time to sleep: N/A')
28+ print('Average time to resume: N/A')
29
30
31 def fix_sleep_args(args):
32@@ -264,9 +268,14 @@ def main():
33 suspend_time, resume_time = get_sleep_times(args.log + '.log',
34 marker)
35 iteration_results[iteration] = (suspend_time, resume_time)
36- progress_string = (
37- 'Cycle %s/%s - Suspend: %0.2f s - Resume: %0.2f s'
38- % (iteration, iterations, suspend_time, resume_time))
39+ if not suspend_time or not resume_time:
40+ progress_string = (
41+ 'Cycle %s/%s - Suspend: N/A s - Resume: N/A s'
42+ % (iteration, iterations))
43+ else:
44+ progress_string = (
45+ 'Cycle %s/%s - Suspend: %0.2f s - Resume: %0.2f s'
46+ % (iteration, iterations, suspend_time, resume_time))
47 progress_pct = "{}".format(int(100 * iteration / iterations))
48 if "zenity" in detect_progress_indicator():
49 progress_indicator.stdin.write("# {}\n".format(
50@@ -322,7 +331,7 @@ def main():
51 if 'ABORTED' in results[test]:
52 aborted.append(test)
53 else:
54- continue
55+ return 1
56
57 if critical_fails:
58 print("Critical Failures: %d" % len(critical_fails))

Subscribers

People subscribed via source and target branches