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 # If this bot is a trybot, write the actual results under the full trybot | |
32 # name. | |
borenet
2013/10/11 15:22:49
I don't think this new comment is really necessary
scroggo
2013/10/11 15:29:44
Removed.
| |
31 device_subdir = self._flavor_utils.DevicePathJoin( | 33 device_subdir = self._flavor_utils.DevicePathJoin( |
32 self._device_dirs.SKImageOutDir(), subdir) | 34 self._device_dirs.SKImageOutDir(), self._builder_name) |
33 self._flavor_utils.CreateCleanDeviceDirectory(device_subdir) | 35 self._flavor_utils.CreateCleanDeviceDirectory(device_subdir) |
34 output_expectations_file = self._flavor_utils.DevicePathJoin( | 36 output_expectations_file = self._flavor_utils.DevicePathJoin( |
35 device_subdir, run_gm.JSON_SUMMARY_FILENAME) | 37 device_subdir, run_gm.JSON_SUMMARY_FILENAME) |
36 | 38 |
37 cmd.extend(['--createExpectationsPath', output_expectations_file]) | 39 cmd.extend(['--createExpectationsPath', output_expectations_file]) |
38 | 40 |
39 # Draw any mismatches to the same folder as the output json. | 41 # Draw any mismatches to the same folder as the output json. |
40 cmd.extend(['--mismatchPath', self._device_dirs.SKImageOutDir()]) | 42 cmd.extend(['--mismatchPath', self._device_dirs.SKImageOutDir()]) |
41 | 43 |
42 self._flavor_utils.RunFlavoredCmd('skimage', cmd) | 44 self._flavor_utils.RunFlavoredCmd('skimage', cmd) |
43 | 45 |
44 # If there is no expectations file, still run the tests, and then report a | 46 # 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 | 47 # failure. Then we'll know to update the expectations with the results of |
46 # running the tests. | 48 # running the tests. |
47 if not have_expectations: | 49 if not have_expectations: |
48 raise BuildStepFailure("Missing expectations file " + expectations_file) | 50 raise BuildStepFailure("Missing expectations file " + expectations_file) |
49 | 51 |
50 if '__main__' == __name__: | 52 if '__main__' == __name__: |
51 sys.exit(BuildStep.RunBuildStep(RunDecodingTests)) | 53 sys.exit(BuildStep.RunBuildStep(RunDecodingTests)) |
OLD | NEW |