results_test.py revision f679e2b90dbd23dd3b0a369a8be77965a07eb698
1#!/usr/bin/python
2
3"""
4Copyright 2013 Google Inc.
5
6Use of this source code is governed by a BSD-style license that can be
7found in the LICENSE file.
8
9Test results.py
10
11TODO(epoger): Create a command to update the expected results (in
12self._output_dir_expected) when appropriate.  For now, you should:
131. examine the results in self._output_dir_actual and make sure they are ok
142. rm -rf self._output_dir_expected
153. mv self._output_dir_actual self._output_dir_expected
16Although, if you're using an SVN checkout, this will blow away .svn directories
17within self._output_dir_expected, which wouldn't be good...
18
19"""
20
21import os
22import sys
23
24# Imports from within Skia
25import base_unittest
26import results
27import gm_json  # must import results first, so that gm_json will be in sys.path
28
29
30class ResultsTest(base_unittest.TestCase):
31
32  def test_gm(self):
33    """Process results of a GM run with the Results object."""
34    results_obj = results.Results(
35        actuals_root=os.path.join(self._input_dir, 'gm-actuals'),
36        expected_root=os.path.join(self._input_dir, 'gm-expectations'),
37        generated_images_root=self._temp_dir)
38    gm_json.WriteToFile(results_obj.get_results_of_type(results.RESULTS_ALL),
39                        os.path.join(self._output_dir_actual, 'gm.json'))
40
41
42def main():
43  base_unittest.main(ResultsTest)
44
45
46if __name__ == '__main__':
47  main()
48