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
=== modified file 'debian/changelog'
--- debian/changelog 2012-09-12 09:28:33 +0000
+++ debian/changelog 2012-09-12 12:19:58 +0000
@@ -87,6 +87,9 @@
87 names > 50 chars (LP: #1046274)87 names > 50 chars (LP: #1046274)
88 * scripts/camera_test, jobs/camera.txt.in: Added a 10s timeout to the camera88 * scripts/camera_test, jobs/camera.txt.in: Added a 10s timeout to the camera
89 still test (LP: #990133)89 still test (LP: #990133)
90 * scripts/graphics_stress_test, scripts/rendercheck_test, jobs/stress.txt.in:
91 Exit with proper error message if rendercheck is not installed.
92 (LP: #1048262)
9093
91 [Zygmunt Krynicki]94 [Zygmunt Krynicki]
92 * Fixed simple duplicate 'the' mistakes (LP: #1040022)95 * Fixed simple duplicate 'the' mistakes (LP: #1040022)
9396
=== modified file 'jobs/stress.txt.in'
--- jobs/stress.txt.in 2012-08-31 12:12:52 +0000
+++ jobs/stress.txt.in 2012-09-12 12:19:58 +0000
@@ -132,7 +132,7 @@
132requires:132requires:
133 package.name == 'x11-apps'133 package.name == 'x11-apps'
134user: root134user: root
135command: 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"135command: 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
136_description:136_description:
137 Run the graphics stress test. This test can take a few minutes.137 Run the graphics stress test. This test can take a few minutes.
138138
139139
=== modified file 'scripts/graphics_stress_test'
--- scripts/graphics_stress_test 2012-08-31 17:20:12 +0000
+++ scripts/graphics_stress_test 2012-09-12 12:19:58 +0000
@@ -207,10 +207,13 @@
207 # and we don't want to store it in memory207 # and we don't want to store it in memory
208 process = Popen(full_command, stdout=temp_file,208 process = Popen(full_command, stdout=temp_file,
209 universal_newlines=True)209 universal_newlines=True)
210 except(OSError):210 except OSError as exc:
211 logging.debug('Error: please make sure that rendercheck '211 if exc.errno == errno.ENOENT:
212 'is installed.')212 logging.error('Error: please make sure that rendercheck '
213 exit(1)213 'is installed.')
214 exit(1)
215 else:
216 raise
214217
215 exit_code = process.wait()218 exit_code = process.wait()
216219
@@ -271,8 +274,17 @@
271274
272 def get_suites_list(self):275 def get_suites_list(self):
273 '''Return a list of the available test suites'''276 '''Return a list of the available test suites'''
274 process = Popen(['rendercheck', '--help'], stdout=PIPE,277 try:
275 stderr=PIPE, universal_newlines=True)278 process = Popen(['rendercheck', '--help'], stdout=PIPE,
279 stderr=PIPE, universal_newlines=True)
280 except OSError as exc:
281 if exc.errno == errno.ENOENT:
282 logging.error('Error: please make sure that rendercheck '
283 'is installed.')
284 exit(1)
285 else:
286 raise
287
276 proc = process.communicate()[1].split('\n')288 proc = process.communicate()[1].split('\n')
277 found = False289 found = False
278 tests_pattern = re.compile('.*Available tests: *(.+).*')290 tests_pattern = re.compile('.*Available tests: *(.+).*')
@@ -356,7 +368,6 @@
356 logfile_handler.setFormatter(logging.Formatter(format))368 logfile_handler.setFormatter(logging.Formatter(format))
357 logger.addHandler(logfile_handler)369 logger.addHandler(logfile_handler)
358 log_path = os.path.abspath(logfile)370 log_path = os.path.abspath(logfile)
359 logging.info("The log can be found at %s" % log_path)
360371
361 # Write only to stdout372 # Write only to stdout
362 else:373 else:
@@ -371,6 +382,9 @@
371382
372 status = 0383 status = 0
373384
385 rendercheck = RenderCheckWrapper(args.temp)
386 tests = rendercheck.get_suites_list()
387
374 # Switch between the tty where X lives and tty10388 # Switch between the tty where X lives and tty10
375 vt_wrap = VtWrapper()389 vt_wrap = VtWrapper()
376 target_vt = 10390 target_vt = 10
@@ -396,7 +410,7 @@
396 else:410 else:
397 logging.error('Error: please run X on a tty other than 10')411 logging.error('Error: please run X on a tty other than 10')
398412
399 # Call sleep 10 times413 # Call sleep x times
400 logging.info('== Sleep test ==')414 logging.info('== Sleep test ==')
401 sleep_test = SuspendWrapper()415 sleep_test = SuspendWrapper()
402 sleep_mode = 'mem'416 sleep_mode = 'mem'
@@ -417,7 +431,7 @@
417 # Skip the test431 # Skip the test
418 logging.info('Skipped (the system does not seem to support S3')432 logging.info('Skipped (the system does not seem to support S3')
419433
420 # Rotate the screen 10 times434 # Rotate the screen x times
421 # The app already rotates the screen 5 times435 # The app already rotates the screen 5 times
422 logging.info('== Rotation test ==')436 logging.info('== Rotation test ==')
423 rotation_test = RotationWrapper()437 rotation_test = RotationWrapper()
@@ -430,11 +444,8 @@
430 logging.error('Failed')444 logging.error('Failed')
431 status = 1445 status = 1
432446
433 # Call rendercheck 10 times447 # Call rendercheck x times
434 logging.info('== Rendercheck test ==')448 logging.info('== Rendercheck test ==')
435 rendercheck = RenderCheckWrapper(args.temp)
436 tests = rendercheck.get_suites_list()
437
438 if rendercheck.run_test(tests, args.iterations,449 if rendercheck.run_test(tests, args.iterations,
439 args.debug) == 0:450 args.debug) == 0:
440 logging.info('Passed')451 logging.info('Passed')
441452
=== modified file 'scripts/rendercheck_test'
--- scripts/rendercheck_test 2012-08-25 16:45:00 +0000
+++ scripts/rendercheck_test 2012-09-12 12:19:58 +0000
@@ -62,10 +62,13 @@
62 # and we don't want to store it in memory62 # and we don't want to store it in memory
63 process = Popen(full_command, stdout=temp_file,63 process = Popen(full_command, stdout=temp_file,
64 universal_newlines=True)64 universal_newlines=True)
65 except(OSError):65 except OSError as exc:
66 logging.debug('Error: please make sure that rendercheck '66 if exc.errno == errno.ENOENT:
67 'is installed.')67 logging.error('Error: please make sure that rendercheck '
68 exit(1)68 'is installed.')
69 exit(1)
70 else:
71 raise
6972
70 exit_code = process.wait()73 exit_code = process.wait()
7174
@@ -126,8 +129,17 @@
126129
127 def get_suites_list(self):130 def get_suites_list(self):
128 '''Return a list of the available test suites'''131 '''Return a list of the available test suites'''
129 process = Popen(['rendercheck', '--help'], stdout=PIPE,132 try:
130 stderr=PIPE, universal_newlines=True)133 process = Popen(['rendercheck', '--help'], stdout=PIPE,
134 stderr=PIPE, universal_newlines=True)
135 except OSError as exc:
136 if exc.errno == errno.ENOENT:
137 logging.error('Error: please make sure that rendercheck '
138 'is installed.')
139 exit(1)
140 else:
141 raise
142
131 proc = process.communicate()[1].split('\n')143 proc = process.communicate()[1].split('\n')
132 found = False144 found = False
133 tests_pattern = re.compile('.*Available tests: *(.+).*')145 tests_pattern = re.compile('.*Available tests: *(.+).*')

Subscribers

People subscribed via source and target branches