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

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

Issue 59283006: rebaseline_server: add pixel diffs, and sorting by diff metrics (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: rename_selftest Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « gm/rebaseline_server/results.py ('k') | gm/rebaseline_server/static/loader.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 """ 3 """
4 Copyright 2013 Google Inc. 4 Copyright 2013 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 HTTP server for our HTML rebaseline viewer. 9 HTTP server for our HTML rebaseline viewer.
10 """ 10 """
(...skipping 27 matching lines...) Expand all
38 import svn 38 import svn
39 39
40 # Imports from local dir 40 # Imports from local dir
41 import results 41 import results
42 42
43 ACTUALS_SVN_REPO = 'http://skia-autogen.googlecode.com/svn/gm-actual' 43 ACTUALS_SVN_REPO = 'http://skia-autogen.googlecode.com/svn/gm-actual'
44 EXPECTATIONS_SVN_REPO = 'http://skia.googlecode.com/svn/trunk/expectations/gm' 44 EXPECTATIONS_SVN_REPO = 'http://skia.googlecode.com/svn/trunk/expectations/gm'
45 PATHSPLIT_RE = re.compile('/([^/]+)/(.+)') 45 PATHSPLIT_RE = re.compile('/([^/]+)/(.+)')
46 TRUNK_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname( 46 TRUNK_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(
47 os.path.realpath(__file__)))) 47 os.path.realpath(__file__))))
48 GENERATED_IMAGES_ROOT = os.path.join(PARENT_DIRECTORY, 'static',
49 'generated-images')
48 50
49 # A simple dictionary of file name extensions to MIME types. The empty string 51 # A simple dictionary of file name extensions to MIME types. The empty string
50 # entry is used as the default when no extension was given or if the extension 52 # entry is used as the default when no extension was given or if the extension
51 # has no entry in this dictionary. 53 # has no entry in this dictionary.
52 MIME_TYPE_MAP = {'': 'application/octet-stream', 54 MIME_TYPE_MAP = {'': 'application/octet-stream',
53 'html': 'text/html', 55 'html': 'text/html',
54 'css': 'text/css', 56 'css': 'text/css',
55 'png': 'image/png', 57 'png': 'image/png',
56 'js': 'application/javascript', 58 'js': 'application/javascript',
57 'json': 'application/json' 59 'json': 'application/json'
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 'Updating expected GM results in %s from SVN repo %s ...' % ( 150 'Updating expected GM results in %s from SVN repo %s ...' % (
149 self._expectations_dir, EXPECTATIONS_SVN_REPO)) 151 self._expectations_dir, EXPECTATIONS_SVN_REPO))
150 expectations_repo = svn.Svn(self._expectations_dir) 152 expectations_repo = svn.Svn(self._expectations_dir)
151 if not os.path.isdir(self._expectations_dir): 153 if not os.path.isdir(self._expectations_dir):
152 os.makedirs(self._expectations_dir) 154 os.makedirs(self._expectations_dir)
153 expectations_repo.Checkout(EXPECTATIONS_SVN_REPO, '.') 155 expectations_repo.Checkout(EXPECTATIONS_SVN_REPO, '.')
154 else: 156 else:
155 expectations_repo.Update('.') 157 expectations_repo.Update('.')
156 158
157 logging.info( 159 logging.info(
158 'Parsing results from actuals in %s and expectations in %s ...' % ( 160 ('Parsing results from actuals in %s and expectations in %s, '
161 + 'and generating pixel diffs (may take a while) ...') % (
159 self._actuals_dir, self._expectations_dir)) 162 self._actuals_dir, self._expectations_dir))
160 self.results = results.Results( 163 self.results = results.Results(
161 actuals_root=self._actuals_dir, 164 actuals_root=self._actuals_dir,
162 expected_root=self._expectations_dir) 165 expected_root=self._expectations_dir,
166 generated_images_root=GENERATED_IMAGES_ROOT)
163 167
164 def _result_reloader(self): 168 def _result_reloader(self):
165 """ If --reload argument was specified, reload results at the appropriate 169 """ If --reload argument was specified, reload results at the appropriate
166 interval. 170 interval.
167 """ 171 """
168 while self._reload_seconds: 172 while self._reload_seconds:
169 time.sleep(self._reload_seconds) 173 time.sleep(self._reload_seconds)
170 self.update_results() 174 self.update_results()
171 175
172 def run(self): 176 def run(self):
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 args = parser.parse_args() 442 args = parser.parse_args()
439 global _SERVER 443 global _SERVER
440 _SERVER = Server(actuals_dir=args.actuals_dir, 444 _SERVER = Server(actuals_dir=args.actuals_dir,
441 expectations_dir=args.expectations_dir, 445 expectations_dir=args.expectations_dir,
442 port=args.port, export=args.export, editable=args.editable, 446 port=args.port, export=args.export, editable=args.editable,
443 reload_seconds=args.reload) 447 reload_seconds=args.reload)
444 _SERVER.run() 448 _SERVER.run()
445 449
446 if __name__ == '__main__': 450 if __name__ == '__main__':
447 main() 451 main()
OLDNEW
« no previous file with comments | « gm/rebaseline_server/results.py ('k') | gm/rebaseline_server/static/loader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698