Merge lp:~sylvain-pineau/checkbox/bug1048262 into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Merged at revision: 1659
Proposed branch: lp:~sylvain-pineau/checkbox/bug1048262
Merge into: lp:checkbox
Diff against target: 159 lines (+46/-20)
4 files modified
debian/changelog (+3/-0)
jobs/stress.txt.in (+1/-1)
scripts/graphics_stress_test (+24/-13)
scripts/rendercheck_test (+18/-6)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/bug1048262
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Sylvain Pineau (community) Needs Resubmitting
Review via email: mp+123936@code.launchpad.net

Description of the change

graphics_stress_test now exits with a proper error message if rendercheck is not installed (i.e: x11-apps in
Precise)

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+ except(OSError):

The syntax is wrong, there is no need for parentheses here

In addition I would add a test for errno (exc.errno == errno.ENOENT) as the catch is otherwise too strong IMHO

As for the rest, what is the point of moving that code around:

59 + rendercheck = RenderCheckWrapper(args.temp)
60 + tests = rendercheck.get_suites_list()
61 +

review: Needs Information
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Good catch, I'm going to fix the except block with your recommendation. But i've just found another script providing the exact same class: rendercheck_test. I will apply the same fix.

The point of moving the call to get_suites_list is to exit on error earlier and not let the script performing useless operations.

1658. By Sylvain Pineau

Fix scripts/graphics_stress_test and scripts/rendercheck_test exception blocks to abort the test only if the error is errno.ENOENT

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Fixed the exception blocks in scripts/graphics_stress_test and scripts/rendercheck_test as they provide the same class: RenderCheck

review: Needs Resubmitting
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-09-12 09:28:33 +0000
3+++ debian/changelog 2012-09-12 12:19:58 +0000
4@@ -87,6 +87,9 @@
5 names > 50 chars (LP: #1046274)
6 * scripts/camera_test, jobs/camera.txt.in: Added a 10s timeout to the camera
7 still test (LP: #990133)
8+ * scripts/graphics_stress_test, scripts/rendercheck_test, jobs/stress.txt.in:
9+ Exit with proper error message if rendercheck is not installed.
10+ (LP: #1048262)
11
12 [Zygmunt Krynicki]
13 * Fixed simple duplicate 'the' mistakes (LP: #1040022)
14
15=== modified file 'jobs/stress.txt.in'
16--- jobs/stress.txt.in 2012-08-31 12:12:52 +0000
17+++ jobs/stress.txt.in 2012-09-12 12:19:58 +0000
18@@ -132,7 +132,7 @@
19 requires:
20 package.name == 'x11-apps'
21 user: root
22-command: graphics_stress_test -d -o $CHECKBOX_DATA/graphics-stress-results && echo "Graphics Stress Test completed successfully" || echo "Graphics Stress Test completed, but there are errors. Please see the log $CHECKBOX_DATA/graphics-stress-results for details"
23+command: graphics_stress_test -d -o $CHECKBOX_DATA/graphics-stress-results && echo "Graphics Stress Test completed successfully" || echo "Graphics Stress Test completed, but there are errors. Please see the log $CHECKBOX_DATA/graphics-stress-results for details" && false
24 _description:
25 Run the graphics stress test. This test can take a few minutes.
26
27
28=== modified file 'scripts/graphics_stress_test'
29--- scripts/graphics_stress_test 2012-08-31 17:20:12 +0000
30+++ scripts/graphics_stress_test 2012-09-12 12:19:58 +0000
31@@ -207,10 +207,13 @@
32 # and we don't want to store it in memory
33 process = Popen(full_command, stdout=temp_file,
34 universal_newlines=True)
35- except(OSError):
36- logging.debug('Error: please make sure that rendercheck '
37- 'is installed.')
38- exit(1)
39+ except OSError as exc:
40+ if exc.errno == errno.ENOENT:
41+ logging.error('Error: please make sure that rendercheck '
42+ 'is installed.')
43+ exit(1)
44+ else:
45+ raise
46
47 exit_code = process.wait()
48
49@@ -271,8 +274,17 @@
50
51 def get_suites_list(self):
52 '''Return a list of the available test suites'''
53- process = Popen(['rendercheck', '--help'], stdout=PIPE,
54- stderr=PIPE, universal_newlines=True)
55+ try:
56+ process = Popen(['rendercheck', '--help'], stdout=PIPE,
57+ stderr=PIPE, universal_newlines=True)
58+ except OSError as exc:
59+ if exc.errno == errno.ENOENT:
60+ logging.error('Error: please make sure that rendercheck '
61+ 'is installed.')
62+ exit(1)
63+ else:
64+ raise
65+
66 proc = process.communicate()[1].split('\n')
67 found = False
68 tests_pattern = re.compile('.*Available tests: *(.+).*')
69@@ -356,7 +368,6 @@
70 logfile_handler.setFormatter(logging.Formatter(format))
71 logger.addHandler(logfile_handler)
72 log_path = os.path.abspath(logfile)
73- logging.info("The log can be found at %s" % log_path)
74
75 # Write only to stdout
76 else:
77@@ -371,6 +382,9 @@
78
79 status = 0
80
81+ rendercheck = RenderCheckWrapper(args.temp)
82+ tests = rendercheck.get_suites_list()
83+
84 # Switch between the tty where X lives and tty10
85 vt_wrap = VtWrapper()
86 target_vt = 10
87@@ -396,7 +410,7 @@
88 else:
89 logging.error('Error: please run X on a tty other than 10')
90
91- # Call sleep 10 times
92+ # Call sleep x times
93 logging.info('== Sleep test ==')
94 sleep_test = SuspendWrapper()
95 sleep_mode = 'mem'
96@@ -417,7 +431,7 @@
97 # Skip the test
98 logging.info('Skipped (the system does not seem to support S3')
99
100- # Rotate the screen 10 times
101+ # Rotate the screen x times
102 # The app already rotates the screen 5 times
103 logging.info('== Rotation test ==')
104 rotation_test = RotationWrapper()
105@@ -430,11 +444,8 @@
106 logging.error('Failed')
107 status = 1
108
109- # Call rendercheck 10 times
110+ # Call rendercheck x times
111 logging.info('== Rendercheck test ==')
112- rendercheck = RenderCheckWrapper(args.temp)
113- tests = rendercheck.get_suites_list()
114-
115 if rendercheck.run_test(tests, args.iterations,
116 args.debug) == 0:
117 logging.info('Passed')
118
119=== modified file 'scripts/rendercheck_test'
120--- scripts/rendercheck_test 2012-08-25 16:45:00 +0000
121+++ scripts/rendercheck_test 2012-09-12 12:19:58 +0000
122@@ -62,10 +62,13 @@
123 # and we don't want to store it in memory
124 process = Popen(full_command, stdout=temp_file,
125 universal_newlines=True)
126- except(OSError):
127- logging.debug('Error: please make sure that rendercheck '
128- 'is installed.')
129- exit(1)
130+ except OSError as exc:
131+ if exc.errno == errno.ENOENT:
132+ logging.error('Error: please make sure that rendercheck '
133+ 'is installed.')
134+ exit(1)
135+ else:
136+ raise
137
138 exit_code = process.wait()
139
140@@ -126,8 +129,17 @@
141
142 def get_suites_list(self):
143 '''Return a list of the available test suites'''
144- process = Popen(['rendercheck', '--help'], stdout=PIPE,
145- stderr=PIPE, universal_newlines=True)
146+ try:
147+ process = Popen(['rendercheck', '--help'], stdout=PIPE,
148+ stderr=PIPE, universal_newlines=True)
149+ except OSError as exc:
150+ if exc.errno == errno.ENOENT:
151+ logging.error('Error: please make sure that rendercheck '
152+ 'is installed.')
153+ exit(1)
154+ else:
155+ raise
156+
157 proc = process.communicate()[1].split('\n')
158 found = False
159 tests_pattern = re.compile('.*Available tests: *(.+).*')

Subscribers

People subscribed via source and target branches