| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """ Run the Skia skimage executable. """ | |
| 7 | |
| 8 from build_step import BuildStep, BuildStepFailure, GM_EXPECTATIONS_FILENAME | |
| 9 # builder_name_schema must be imported after build_step so the PYTHONPATH will | |
| 10 # be set properly to import it. | |
| 11 import builder_name_schema | |
| 12 import run_gm | |
| 13 import sys | |
| 14 | |
| 15 class RunDecodingTests(BuildStep): | |
| 16 def _Run(self): | |
| 17 cmd = ['-r', self._device_dirs.SKImageInDir(), '--noreencode', | |
| 18 '--writeChecksumBasedFilenames', '--config', '8888'] | |
| 19 | |
| 20 waterfall_name = builder_name_schema.GetWaterfallBot(self._builder_name) | |
| 21 | |
| 22 # Read expectations, which were downloaded/copied to the device. | |
| 23 # If this bot is a trybot, read the expected results of the waterfall bot. | |
| 24 expectations_file = self._flavor_utils.DevicePathJoin( | |
| 25 self._device_dirs.SKImageExpectedDir(), waterfall_name, | |
| 26 GM_EXPECTATIONS_FILENAME) | |
| 27 | |
| 28 have_expectations = self._flavor_utils.DevicePathExists(expectations_file) | |
| 29 if have_expectations: | |
| 30 cmd.extend(['--readExpectationsPath', expectations_file]) | |
| 31 | |
| 32 # Write the expectations file, in case any did not match. | |
| 33 device_subdir = self._flavor_utils.DevicePathJoin( | |
| 34 self._device_dirs.SKImageOutDir(), self._builder_name) | |
| 35 self._flavor_utils.CreateCleanDeviceDirectory(device_subdir) | |
| 36 output_expectations_file = self._flavor_utils.DevicePathJoin( | |
| 37 device_subdir, run_gm.JSON_SUMMARY_FILENAME) | |
| 38 | |
| 39 cmd.extend(['--createExpectationsPath', output_expectations_file]) | |
| 40 | |
| 41 # Draw any mismatches to a folder inside SKImageOutDir. | |
| 42 image_out_dir = self._flavor_utils.DevicePathJoin( | |
| 43 self._device_dirs.SKImageOutDir(), 'images') | |
| 44 self._flavor_utils.CreateCleanDeviceDirectory(image_out_dir) | |
| 45 cmd.extend(['--mismatchPath', image_out_dir]) | |
| 46 | |
| 47 self._flavor_utils.RunFlavoredCmd('skimage', cmd) | |
| 48 | |
| 49 # If there is no expectations file, still run the tests, and then report a | |
| 50 # failure. Then we'll know to update the expectations with the results of | |
| 51 # running the tests. | |
| 52 # TODO(scroggo): Skipping the TSAN bot, where we'll never have | |
| 53 # expectations. A better way might be to have empty expectations. See | |
| 54 # https://code.google.com/p/skia/issues/detail?id=1711 | |
| 55 if not have_expectations and not 'TSAN' in self._builder_name: | |
| 56 name = self._builder_name | |
| 57 msg = (('Missing expectations file %s.\n' | |
| 58 'In order to blindly use the actual results as the expectations,' | |
| 59 '\nrun the following commands once UploadSKImageResults ' | |
| 60 'succeeds:\n') % expectations_file) | |
| 61 cmds = (('$ gsutil cp -R gs://chromium-skia-gm/skimage/actuals/%s ' | |
| 62 'expectations/skimage/%s\n') % (name, waterfall_name)) | |
| 63 | |
| 64 cmds += (('$ mv expectations/skimage/%s/actual-results.json ' | |
| 65 'expectations/skimage/%s/%s\n') % | |
| 66 (waterfall_name, waterfall_name, GM_EXPECTATIONS_FILENAME)) | |
| 67 cmds += '\nThen check in using git.\n' | |
| 68 raise BuildStepFailure(msg + cmds) | |
| 69 | |
| 70 if '__main__' == __name__: | |
| 71 sys.exit(BuildStep.RunBuildStep(RunDecodingTests)) | |
| OLD | NEW |