2013-12-23 22:47:15 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
"""
|
|
|
|
Copyright 2013 Google Inc.
|
|
|
|
|
|
|
|
Use of this source code is governed by a BSD-style license that can be
|
|
|
|
found in the LICENSE file.
|
|
|
|
|
|
|
|
Test results.py
|
|
|
|
|
|
|
|
TODO(epoger): Create a command to update the expected results (in
|
2014-02-19 15:38:13 +00:00
|
|
|
self._output_dir_expected) when appropriate. For now, you should:
|
|
|
|
1. examine the results in self._output_dir_actual and make sure they are ok
|
|
|
|
2. rm -rf self._output_dir_expected
|
|
|
|
3. mv self._output_dir_actual self._output_dir_expected
|
2013-12-23 22:47:15 +00:00
|
|
|
Although, if you're using an SVN checkout, this will blow away .svn directories
|
2014-02-19 15:38:13 +00:00
|
|
|
within self._output_dir_expected, which wouldn't be good...
|
2013-12-23 22:47:15 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# Imports from within Skia
|
2014-02-19 15:38:13 +00:00
|
|
|
import base_unittest
|
2013-12-23 22:47:15 +00:00
|
|
|
import results
|
|
|
|
import gm_json # must import results first, so that gm_json will be in sys.path
|
|
|
|
|
2014-01-03 16:04:11 +00:00
|
|
|
|
2014-02-19 15:38:13 +00:00
|
|
|
class ResultsTest(base_unittest.TestCase):
|
2014-01-06 18:33:19 +00:00
|
|
|
|
2013-12-23 22:47:15 +00:00
|
|
|
def test_gm(self):
|
|
|
|
"""Process results of a GM run with the Results object."""
|
|
|
|
results_obj = results.Results(
|
2014-02-19 15:38:13 +00:00
|
|
|
actuals_root=os.path.join(self._input_dir, 'gm-actuals'),
|
|
|
|
expected_root=os.path.join(self._input_dir, 'gm-expectations'),
|
2014-01-03 16:04:11 +00:00
|
|
|
generated_images_root=self._temp_dir)
|
2014-02-26 19:05:20 +00:00
|
|
|
gm_json.WriteToFile(
|
|
|
|
results_obj.get_results_of_type(results.KEY__HEADER__RESULTS_ALL),
|
|
|
|
os.path.join(self._output_dir_actual, 'gm.json'))
|
2014-01-03 16:04:11 +00:00
|
|
|
|
|
|
|
|
2013-12-23 22:47:15 +00:00
|
|
|
def main():
|
2014-02-19 15:38:13 +00:00
|
|
|
base_unittest.main(ResultsTest)
|
2013-12-23 22:47:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|