OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 |
| 3 """ |
| 4 Copyright 2014 Google Inc. |
| 5 |
| 6 Use of this source code is governed by a BSD-style license that can be |
| 7 found in the LICENSE file. |
| 8 |
| 9 Test compare_configs.py |
| 10 |
| 11 TODO(epoger): Create a command to update the expected results (in |
| 12 self._output_dir_expected) when appropriate. For now, you should: |
| 13 1. examine the results in self.output_dir_actual and make sure they are ok |
| 14 2. rm -rf self._output_dir_expected |
| 15 3. mv self.output_dir_actual self._output_dir_expected |
| 16 Although, if you're using an SVN checkout, this will blow away .svn directories |
| 17 within self._output_dir_expected, which wouldn't be good... |
| 18 |
| 19 """ |
| 20 |
| 21 # System-level imports |
| 22 import os |
| 23 |
| 24 # Must fix up PYTHONPATH before importing from within Skia |
| 25 import rs_fixpypath # pylint: disable=W0611 |
| 26 |
| 27 # Imports from within Skia |
| 28 import base_unittest |
| 29 import compare_configs |
| 30 import gm_json |
| 31 import results |
| 32 |
| 33 |
| 34 class CompareConfigsTest(base_unittest.TestCase): |
| 35 |
| 36 def test_gm(self): |
| 37 """Process results of a GM run with the ConfigComparisons object.""" |
| 38 results_obj = compare_configs.ConfigComparisons( |
| 39 configs=('8888', 'gpu'), |
| 40 actuals_root=os.path.join(self.input_dir, 'gm-actuals'), |
| 41 generated_images_root=self.temp_dir, |
| 42 diff_base_url='/static/generated-images') |
| 43 results_obj.get_timestamp = mock_get_timestamp |
| 44 gm_json.WriteToFile( |
| 45 results_obj.get_packaged_results_of_type( |
| 46 results.KEY__HEADER__RESULTS_ALL), |
| 47 os.path.join(self.output_dir_actual, 'gm.json')) |
| 48 |
| 49 |
| 50 def mock_get_timestamp(): |
| 51 """Mock version of BaseComparisons.get_timestamp() for testing.""" |
| 52 return 12345678 |
| 53 |
| 54 |
| 55 def main(): |
| 56 base_unittest.main(CompareConfigsTest) |
| 57 |
| 58 |
| 59 if __name__ == '__main__': |
| 60 main() |
OLD | NEW |