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 | 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 sys | 13 import sys |
13 | 14 |
14 class RunDecodingTests(BuildStep): | 15 class RunDecodingTests(BuildStep): |
15 def _Run(self): | 16 def _Run(self): |
16 cmd = ['-r', self._device_dirs.SKImageInDir(), '--noreencode'] | 17 cmd = ['-r', self._device_dirs.SKImageInDir(), '--noreencode'] |
17 | 18 |
18 expectations_name = (builder_name_schema.GetWaterfallBot(self._builder_name) | 19 subdir = builder_name_schema.GetWaterfallBot(self._builder_name) |
19 + '.json') | |
20 | 20 |
21 # Read expectations, which were downloaded/copied to the device. | 21 # Read expectations, which were downloaded/copied to the device. |
22 expectations_file = self._flavor_utils.DevicePathJoin( | 22 expectations_file = self._flavor_utils.DevicePathJoin( |
23 self._device_dirs.SKImageExpectedDir(), | 23 self._device_dirs.SKImageExpectedDir(), subdir, |
24 expectations_name) | 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( |
| 32 self._device_dirs.SKImageOutDir(), subdir) |
| 33 self._flavor_utils.CreateCleanDeviceDirectory(device_subdir) |
31 output_expectations_file = self._flavor_utils.DevicePathJoin( | 34 output_expectations_file = self._flavor_utils.DevicePathJoin( |
32 self._device_dirs.SKImageOutDir(), | 35 device_subdir, run_gm.JSON_SUMMARY_FILENAME) |
33 expectations_name) | |
34 | 36 |
35 cmd.extend(['--createExpectationsPath', output_expectations_file]) | 37 cmd.extend(['--createExpectationsPath', output_expectations_file]) |
36 | 38 |
37 # Draw any mismatches to the same folder as the output json. | 39 # Draw any mismatches to the same folder as the output json. |
38 cmd.extend(['--mismatchPath', self._device_dirs.SKImageOutDir()]) | 40 cmd.extend(['--mismatchPath', self._device_dirs.SKImageOutDir()]) |
39 | 41 |
40 self._flavor_utils.RunFlavoredCmd('skimage', cmd) | 42 self._flavor_utils.RunFlavoredCmd('skimage', cmd) |
41 | 43 |
42 # 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 |
43 # 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 |
44 # running the tests. | 46 # running the tests. |
45 if not have_expectations: | 47 if not have_expectations: |
46 raise BuildStepFailure("Missing expectations file " + expectations_file) | 48 raise BuildStepFailure("Missing expectations file " + expectations_file) |
47 | 49 |
48 if '__main__' == __name__: | 50 if '__main__' == __name__: |
49 sys.exit(BuildStep.RunBuildStep(RunDecodingTests)) | 51 sys.exit(BuildStep.RunBuildStep(RunDecodingTests)) |
OLD | NEW |