Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: gm/rebaseline_server/compare_rendered_pictures_test.py

Issue 453433004: rebaseline_server: allow live queries to examine JSONKEY_EXPECTEDRESULTS or JSONKEY_ACTUALRESULTS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: create ALLOWED_SECTION_NAMES Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 """ 3 """
4 Copyright 2014 Google Inc. 4 Copyright 2014 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 8
9 Test compare_rendered_pictures.py 9 Test compare_rendered_pictures.py
10 10
11 TODO(epoger): Create a command to update the expected results (in 11 TODO(epoger): Create a command to update the expected results (in
12 self._output_dir_expected) when appropriate. For now, you should: 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 13 1. examine the results in self.output_dir_actual and make sure they are ok
14 2. rm -rf self._output_dir_expected 14 2. rm -rf self._output_dir_expected
15 3. mv self.output_dir_actual 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 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... 17 within self._output_dir_expected, which wouldn't be good...
18 18
19 """ 19 """
20 20
21 # System-level imports 21 # System-level imports
22 import os 22 import os
23 import posixpath
23 import subprocess 24 import subprocess
24 25
25 # Must fix up PYTHONPATH before importing from within Skia 26 # Must fix up PYTHONPATH before importing from within Skia
26 import fix_pythonpath # pylint: disable=W0611 27 import fix_pythonpath # pylint: disable=W0611
27 28
28 # Imports from within Skia 29 # Imports from within Skia
29 import base_unittest 30 import base_unittest
30 import compare_rendered_pictures 31 import compare_rendered_pictures
31 import find_run_binary 32 import find_run_binary
32 import gm_json 33 import gm_json
(...skipping 17 matching lines...) Expand all
50 self._generate_skps_and_run_render_pictures( 51 self._generate_skps_and_run_render_pictures(
51 subdir=setB_label, skpdict={ 52 subdir=setB_label, skpdict={
52 'changed.skp': 201, 53 'changed.skp': 201,
53 'unchanged.skp': 100, 54 'unchanged.skp': 100,
54 'only-in-after.skp': 128, 55 'only-in-after.skp': 128,
55 }) 56 })
56 57
57 results_obj = compare_rendered_pictures.RenderedPicturesComparisons( 58 results_obj = compare_rendered_pictures.RenderedPicturesComparisons(
58 setA_dirs=[os.path.join(self.temp_dir, setA_label)], 59 setA_dirs=[os.path.join(self.temp_dir, setA_label)],
59 setB_dirs=[os.path.join(self.temp_dir, setB_label)], 60 setB_dirs=[os.path.join(self.temp_dir, setB_label)],
61 setA_section=gm_json.JSONKEY_ACTUALRESULTS,
62 setB_section=gm_json.JSONKEY_ACTUALRESULTS,
60 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir), 63 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir),
61 image_base_gs_url='gs://fakebucket/fake/path', 64 image_base_gs_url='gs://fakebucket/fake/path',
62 diff_base_url='/static/generated-images', 65 diff_base_url='/static/generated-images',
63 setA_label=setA_label, setB_label=setB_label) 66 setA_label=setA_label, setB_label=setB_label)
64 results_obj.get_timestamp = mock_get_timestamp 67 results_obj.get_timestamp = mock_get_timestamp
65 68
66 gm_json.WriteToFile( 69 gm_json.WriteToFile(
67 results_obj.get_packaged_results_of_type( 70 results_obj.get_packaged_results_of_type(
68 results.KEY__HEADER__RESULTS_ALL), 71 results.KEY__HEADER__RESULTS_ALL),
69 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json')) 72 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json'))
70 73
71 def test_repo_url(self): 74 def test_repo_url(self):
72 """Use repo: URL to specify summary files.""" 75 """Use repo: URL to specify summary files."""
76 base_repo_url = 'repo:gm/rebaseline_server/testdata/inputs/skp-summaries'
73 results_obj = compare_rendered_pictures.RenderedPicturesComparisons( 77 results_obj = compare_rendered_pictures.RenderedPicturesComparisons(
74 setA_dirs=[ 78 setA_dirs=[posixpath.join(base_repo_url, 'expectations')],
75 'repo:gm/rebaseline_server/testdata/inputs/skp-actuals/setA'], 79 setB_dirs=[posixpath.join(base_repo_url, 'actuals')],
rmistry 2014/08/07 18:57:05 Side question: about the posixpath.joins, the reba
epoger 2014/08/07 19:03:18 It should work on Windows (not that I've tried it)
76 setB_dirs=[ 80 setA_section=gm_json.JSONKEY_EXPECTEDRESULTS,
77 'repo:gm/rebaseline_server/testdata/inputs/skp-actuals/setB'], 81 setB_section=gm_json.JSONKEY_ACTUALRESULTS,
78 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir), 82 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir),
79 image_base_gs_url='gs://fakebucket/fake/path', 83 image_base_gs_url='gs://fakebucket/fake/path',
80 diff_base_url='/static/generated-images', 84 diff_base_url='/static/generated-images',
81 setA_label='setA', setB_label='setB') 85 setA_label='setA', setB_label='setB')
82 results_obj.get_timestamp = mock_get_timestamp 86 results_obj.get_timestamp = mock_get_timestamp
83 87
84 gm_json.WriteToFile( 88 gm_json.WriteToFile(
85 results_obj.get_packaged_results_of_type( 89 results_obj.get_packaged_results_of_type(
86 results.KEY__HEADER__RESULTS_ALL), 90 results.KEY__HEADER__RESULTS_ALL),
87 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json')) 91 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json'))
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 """Mock version of BaseComparisons.get_timestamp() for testing.""" 141 """Mock version of BaseComparisons.get_timestamp() for testing."""
138 return 12345678 142 return 12345678
139 143
140 144
141 def main(): 145 def main():
142 base_unittest.main(CompareRenderedPicturesTest) 146 base_unittest.main(CompareRenderedPicturesTest)
143 147
144 148
145 if __name__ == '__main__': 149 if __name__ == '__main__':
146 main() 150 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698