OLD | NEW |
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 Compare results of two render_pictures runs. | 9 Compare results of two render_pictures runs. |
10 | 10 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 column_ids_in_order=ORDERED_COLUMN_IDS), | 344 column_ids_in_order=ORDERED_COLUMN_IDS), |
345 } | 345 } |
346 | 346 |
347 def _validate_dict_version(self, result_dict): | 347 def _validate_dict_version(self, result_dict): |
348 """Raises Exception if the dict is not the type/version we know how to read. | 348 """Raises Exception if the dict is not the type/version we know how to read. |
349 | 349 |
350 Args: | 350 Args: |
351 result_dict: dictionary holding output of render_pictures; if None, | 351 result_dict: dictionary holding output of render_pictures; if None, |
352 this method will return without raising an Exception | 352 this method will return without raising an Exception |
353 """ | 353 """ |
| 354 # TODO(stephana): These values should be defined as constants somewhere, |
| 355 # to be kept in sync between this file and writable_expectations.py |
354 expected_header_type = 'ChecksummedImages' | 356 expected_header_type = 'ChecksummedImages' |
355 expected_header_revision = 1 | 357 expected_header_revision = 1 |
356 | 358 |
357 if result_dict == None: | 359 if result_dict == None: |
358 return | 360 return |
359 header = result_dict[gm_json.JSONKEY_HEADER] | 361 header = result_dict[gm_json.JSONKEY_HEADER] |
360 header_type = header[gm_json.JSONKEY_HEADER_TYPE] | 362 header_type = header[gm_json.JSONKEY_HEADER_TYPE] |
361 if header_type != expected_header_type: | 363 if header_type != expected_header_type: |
362 raise Exception('expected header_type "%s", but got "%s"' % ( | 364 raise Exception('expected header_type "%s", but got "%s"' % ( |
363 expected_header_type, header_type)) | 365 expected_header_type, header_type)) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 source_dir: path to source dir (GS URL, local filepath, or a special | 479 source_dir: path to source dir (GS URL, local filepath, or a special |
478 "repo:" URL type that points at a file within our Skia checkout; | 480 "repo:" URL type that points at a file within our Skia checkout; |
479 only the "repo:" URL type will have a commit hash. | 481 only the "repo:" URL type will have a commit hash. |
480 """ | 482 """ |
481 if source_dir.lower().startswith(REPO_URL_PREFIX): | 483 if source_dir.lower().startswith(REPO_URL_PREFIX): |
482 repo_dir = os.path.join(REPO_BASEPATH, source_dir[len(REPO_URL_PREFIX):]) | 484 repo_dir = os.path.join(REPO_BASEPATH, source_dir[len(REPO_URL_PREFIX):]) |
483 return subprocess.check_output( | 485 return subprocess.check_output( |
484 args=[git_utils.GIT, 'rev-parse', 'HEAD'], cwd=repo_dir).strip() | 486 args=[git_utils.GIT, 'rev-parse', 'HEAD'], cwd=repo_dir).strip() |
485 else: | 487 else: |
486 return None | 488 return None |
OLD | NEW |