| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ Run the Skia skimage executable. """ | 6 """ Run the Skia skimage executable. """ |
| 7 | 7 |
| 8 from build_step import BuildStep, BuildStepFailure, GM_EXPECTATIONS_FILENAME | 8 from build_step import BuildStep, BuildStepFailure, GM_EXPECTATIONS_FILENAME |
| 9 # builder_name_schema must be imported after build_step so the PYTHONPATH will | 9 # builder_name_schema must be imported after build_step so the PYTHONPATH will |
| 10 # be set properly to import it. | 10 # be set properly to import it. |
| 11 import builder_name_schema | 11 import builder_name_schema |
| 12 import run_gm | 12 import run_gm |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 class RunDecodingTests(BuildStep): | 15 class RunDecodingTests(BuildStep): |
| 16 def _Run(self): | 16 def _Run(self): |
| 17 cmd = ['-r', self._device_dirs.SKImageInDir(), '--noreencode'] | 17 cmd = ['-r', self._device_dirs.SKImageInDir(), '--noreencode'] |
| 18 | 18 |
| 19 subdir = builder_name_schema.GetWaterfallBot(self._builder_name) | |
| 20 | |
| 21 # Read expectations, which were downloaded/copied to the device. | 19 # Read expectations, which were downloaded/copied to the device. |
| 20 # If this bot is a trybot, read the expected results of the waterfall bot. |
| 22 expectations_file = self._flavor_utils.DevicePathJoin( | 21 expectations_file = self._flavor_utils.DevicePathJoin( |
| 23 self._device_dirs.SKImageExpectedDir(), subdir, | 22 self._device_dirs.SKImageExpectedDir(), |
| 23 builder_name_schema.GetWaterfallBot(self._builder_name), |
| 24 GM_EXPECTATIONS_FILENAME) | 24 GM_EXPECTATIONS_FILENAME) |
| 25 | 25 |
| 26 have_expectations = self._flavor_utils.DevicePathExists(expectations_file) | 26 have_expectations = self._flavor_utils.DevicePathExists(expectations_file) |
| 27 if have_expectations: | 27 if have_expectations: |
| 28 cmd.extend(['--readExpectationsPath', expectations_file]) | 28 cmd.extend(['--readExpectationsPath', expectations_file]) |
| 29 | 29 |
| 30 # Write the expectations file, in case any did not match. | 30 # Write the expectations file, in case any did not match. |
| 31 device_subdir = self._flavor_utils.DevicePathJoin( | 31 device_subdir = self._flavor_utils.DevicePathJoin( |
| 32 self._device_dirs.SKImageOutDir(), subdir) | 32 self._device_dirs.SKImageOutDir(), self._builder_name) |
| 33 self._flavor_utils.CreateCleanDeviceDirectory(device_subdir) | 33 self._flavor_utils.CreateCleanDeviceDirectory(device_subdir) |
| 34 output_expectations_file = self._flavor_utils.DevicePathJoin( | 34 output_expectations_file = self._flavor_utils.DevicePathJoin( |
| 35 device_subdir, run_gm.JSON_SUMMARY_FILENAME) | 35 device_subdir, run_gm.JSON_SUMMARY_FILENAME) |
| 36 | 36 |
| 37 cmd.extend(['--createExpectationsPath', output_expectations_file]) | 37 cmd.extend(['--createExpectationsPath', output_expectations_file]) |
| 38 | 38 |
| 39 # Draw any mismatches to the same folder as the output json. | 39 # Draw any mismatches to the same folder as the output json. |
| 40 cmd.extend(['--mismatchPath', self._device_dirs.SKImageOutDir()]) | 40 cmd.extend(['--mismatchPath', self._device_dirs.SKImageOutDir()]) |
| 41 | 41 |
| 42 self._flavor_utils.RunFlavoredCmd('skimage', cmd) | 42 self._flavor_utils.RunFlavoredCmd('skimage', cmd) |
| 43 | 43 |
| 44 # If there is no expectations file, still run the tests, and then report a | 44 # If there is no expectations file, still run the tests, and then report a |
| 45 # failure. Then we'll know to update the expectations with the results of | 45 # failure. Then we'll know to update the expectations with the results of |
| 46 # running the tests. | 46 # running the tests. |
| 47 if not have_expectations: | 47 if not have_expectations: |
| 48 raise BuildStepFailure("Missing expectations file " + expectations_file) | 48 raise BuildStepFailure("Missing expectations file " + expectations_file) |
| 49 | 49 |
| 50 if '__main__' == __name__: | 50 if '__main__' == __name__: |
| 51 sys.exit(BuildStep.RunBuildStep(RunDecodingTests)) | 51 sys.exit(BuildStep.RunBuildStep(RunDecodingTests)) |
| OLD | NEW |