diff options
author | epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-02 20:54:46 +0000 |
---|---|---|
committer | epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-02 20:54:46 +0000 |
commit | 2a192a8577911fec6d3b7f8a0ef7e5988ca563cc (patch) | |
tree | d88e87618fc903a77bae7c054abf74cf9a5fd975 | |
parent | e2e01ffb948468d4c3701f7f2a1d0c5ea75657f4 (diff) |
Delete image-based rebaselining tool; we have switched to checksums
R=borenet@google.com
Review URL: https://codereview.chromium.org/21901004
git-svn-id: http://skia.googlecode.com/svn/trunk@10524 2bbb7eff-a529-9590-31e7-b0007b416f81
18 files changed, 224 insertions, 686 deletions
diff --git a/tools/rebaseline.py b/tools/rebaseline.py index bf0e1cb1b3..b80ab9fb29 100755 --- a/tools/rebaseline.py +++ b/tools/rebaseline.py @@ -9,8 +9,6 @@ found in the LICENSE file. ''' Rebaselines the given GM tests, on all bots and all configurations. - -TODO(epoger): Fix indentation in this file (2-space indents, not 4-space). ''' # System-level imports @@ -21,9 +19,6 @@ import subprocess import sys import urllib2 -# Imports from local directory -import rebaseline_imagefiles - # Imports from within Skia # # We need to add the 'gm' directory, so that we can import gm_json.py within @@ -38,7 +33,7 @@ import rebaseline_imagefiles GM_DIRECTORY = os.path.realpath( os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gm')) if GM_DIRECTORY not in sys.path: - sys.path.append(GM_DIRECTORY) + sys.path.append(GM_DIRECTORY) import gm_json # Mapping of expectations/gm subdir (under @@ -73,209 +68,207 @@ SUBDIR_MAPPING = { class _InternalException(Exception): - pass + pass # Object that handles exceptions, either raising them immediately or collecting # them to display later on. class ExceptionHandler(object): - # params: - # keep_going_on_failure: if False, report failures and quit right away; - # if True, collect failures until - # ReportAllFailures() is called - def __init__(self, keep_going_on_failure=False): - self._keep_going_on_failure = keep_going_on_failure - self._failures_encountered = [] - self._exiting = False - - # Exit the program with the given status value. - def _Exit(self, status=1): - self._exiting = True - sys.exit(status) - - # We have encountered an exception; either collect the info and keep going, - # or exit the program right away. - def RaiseExceptionOrContinue(self, e): - # If we are already quitting the program, propagate any exceptions - # so that the proper exit status will be communicated to the shell. - if self._exiting: - raise e - - if self._keep_going_on_failure: - print >> sys.stderr, 'WARNING: swallowing exception %s' % e - self._failures_encountered.append(e) - else: - print >> sys.stderr, e - print >> sys.stderr, ( - 'Halting at first exception; to keep going, re-run ' + - 'with the --keep-going-on-failure option set.') - self._Exit() + # params: + # keep_going_on_failure: if False, report failures and quit right away; + # if True, collect failures until + # ReportAllFailures() is called + def __init__(self, keep_going_on_failure=False): + self._keep_going_on_failure = keep_going_on_failure + self._failures_encountered = [] + self._exiting = False + + # Exit the program with the given status value. + def _Exit(self, status=1): + self._exiting = True + sys.exit(status) + + # We have encountered an exception; either collect the info and keep going, + # or exit the program right away. + def RaiseExceptionOrContinue(self, e): + # If we are already quitting the program, propagate any exceptions + # so that the proper exit status will be communicated to the shell. + if self._exiting: + raise e + + if self._keep_going_on_failure: + print >> sys.stderr, 'WARNING: swallowing exception %s' % e + self._failures_encountered.append(e) + else: + print >> sys.stderr, e + print >> sys.stderr, ( + 'Halting at first exception; to keep going, re-run ' + + 'with the --keep-going-on-failure option set.') + self._Exit() - def ReportAllFailures(self): - if self._failures_encountered: - print >> sys.stderr, ('Encountered %d failures (see above).' % - len(self._failures_encountered)) - self._Exit() + def ReportAllFailures(self): + if self._failures_encountered: + print >> sys.stderr, ('Encountered %d failures (see above).' % + len(self._failures_encountered)) + self._Exit() # Object that rebaselines a JSON expectations file (not individual image files). class JsonRebaseliner(object): - # params: - # expectations_root: root directory of all expectations JSON files - # expectations_input_filename: filename (under expectations_root) of JSON - # expectations file to read; typically - # "expected-results.json" - # expectations_output_filename: filename (under expectations_root) to - # which updated expectations should be - # written; typically the same as - # expectations_input_filename, to overwrite - # the old content - # actuals_base_url: base URL from which to read actual-result JSON files - # actuals_filename: filename (under actuals_base_url) from which to read a - # summary of results; typically "actual-results.json" - # exception_handler: reference to rebaseline.ExceptionHandler object - # tests: list of tests to rebaseline, or None if we should rebaseline - # whatever files the JSON results summary file tells us to - # configs: which configs to run for each test, or None if we should - # rebaseline whatever configs the JSON results summary file tells - # us to - # add_new: if True, add expectations for tests which don't have any yet - def __init__(self, expectations_root, expectations_input_filename, - expectations_output_filename, actuals_base_url, - actuals_filename, exception_handler, - tests=None, configs=None, add_new=False): - self._expectations_root = expectations_root - self._expectations_input_filename = expectations_input_filename - self._expectations_output_filename = expectations_output_filename - self._tests = tests - self._configs = configs - self._actuals_base_url = actuals_base_url - self._actuals_filename = actuals_filename - self._exception_handler = exception_handler - self._add_new = add_new - self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) - self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn')) - - # Executes subprocess.call(cmd). - # Raises an Exception if the command fails. - def _Call(self, cmd): - if subprocess.call(cmd) != 0: - raise _InternalException('error running command: ' + ' '.join(cmd)) - - # Returns the full contents of filepath, as a single string. - # If filepath looks like a URL, try to read it that way instead of as - # a path on local storage. - # - # Raises _InternalException if there is a problem. - def _GetFileContents(self, filepath): - if filepath.startswith('http:') or filepath.startswith('https:'): - try: - return urllib2.urlopen(filepath).read() - except urllib2.HTTPError as e: - raise _InternalException('unable to read URL %s: %s' % ( - filepath, e)) - else: - return open(filepath, 'r').read() - - # Returns a dictionary of actual results from actual-results.json file. - # - # The dictionary returned has this format: - # { - # u'imageblur_565.png': [u'bitmap-64bitMD5', 3359963596899141322], - # u'imageblur_8888.png': [u'bitmap-64bitMD5', 4217923806027861152], - # u'shadertext3_8888.png': [u'bitmap-64bitMD5', 3713708307125704716] - # } - # - # If the JSON actual result summary file cannot be loaded, logs a warning - # message and returns None. - # If the JSON actual result summary file can be loaded, but we have - # trouble parsing it, raises an Exception. - # - # params: - # json_url: URL pointing to a JSON actual result summary file - # sections: a list of section names to include in the results, e.g. - # [gm_json.JSONKEY_ACTUALRESULTS_FAILED, - # gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON] ; - # if None, then include ALL sections. - def _GetActualResults(self, json_url, sections=None): - try: - json_contents = self._GetFileContents(json_url) - except _InternalException: - print >> sys.stderr, ( - 'could not read json_url %s ; skipping this platform.' % - json_url) - return None - json_dict = gm_json.LoadFromString(json_contents) - results_to_return = {} - actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS] - if not sections: - sections = actual_results.keys() - for section in sections: - section_results = actual_results[section] - if section_results: - results_to_return.update(section_results) - return results_to_return - - # Rebaseline all tests/types we specified in the constructor, - # within this expectations/gm subdir. - # - # params: - # subdir : e.g. 'base-shuttle-win7-intel-float' - # builder : e.g. 'Test-Win7-ShuttleA-HD2000-x86-Release' - def RebaselineSubdir(self, subdir, builder): - # Read in the actual result summary, and extract all the tests whose - # results we need to update. - actuals_url = '/'.join([self._actuals_base_url, - subdir, builder, subdir, - self._actuals_filename]) - # In most cases, we won't need to re-record results that are already - # succeeding, but including the SUCCEEDED results will allow us to - # re-record expectations if they somehow get out of sync. - sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED, - gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED] - if self._add_new: - sections.append(gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON) - results_to_update = self._GetActualResults(json_url=actuals_url, - sections=sections) - - # Read in current expectations. - expectations_input_filepath = os.path.join( - self._expectations_root, subdir, self._expectations_input_filename) - expectations_dict = gm_json.LoadFromFile(expectations_input_filepath) - expected_results = expectations_dict[gm_json.JSONKEY_EXPECTEDRESULTS] - - # Update the expectations in memory, skipping any tests/configs that - # the caller asked to exclude. - skipped_images = [] - if results_to_update: - for (image_name, image_results) in results_to_update.iteritems(): - (test, config) = \ - self._image_filename_re.match(image_name).groups() - if self._tests: - if test not in self._tests: - skipped_images.append(image_name) - continue - if self._configs: - if config not in self._configs: - skipped_images.append(image_name) - continue - if not expected_results.get(image_name): - expected_results[image_name] = {} - expected_results[image_name] \ - [gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] = \ + # params: + # expectations_root: root directory of all expectations JSON files + # expectations_input_filename: filename (under expectations_root) of JSON + # expectations file to read; typically + # "expected-results.json" + # expectations_output_filename: filename (under expectations_root) to + # which updated expectations should be + # written; typically the same as + # expectations_input_filename, to overwrite + # the old content + # actuals_base_url: base URL from which to read actual-result JSON files + # actuals_filename: filename (under actuals_base_url) from which to read a + # summary of results; typically "actual-results.json" + # exception_handler: reference to rebaseline.ExceptionHandler object + # tests: list of tests to rebaseline, or None if we should rebaseline + # whatever files the JSON results summary file tells us to + # configs: which configs to run for each test, or None if we should + # rebaseline whatever configs the JSON results summary file tells + # us to + # add_new: if True, add expectations for tests which don't have any yet + def __init__(self, expectations_root, expectations_input_filename, + expectations_output_filename, actuals_base_url, + actuals_filename, exception_handler, + tests=None, configs=None, add_new=False): + self._expectations_root = expectations_root + self._expectations_input_filename = expectations_input_filename + self._expectations_output_filename = expectations_output_filename + self._tests = tests + self._configs = configs + self._actuals_base_url = actuals_base_url + self._actuals_filename = actuals_filename + self._exception_handler = exception_handler + self._add_new = add_new + self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) + self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn')) + + # Executes subprocess.call(cmd). + # Raises an Exception if the command fails. + def _Call(self, cmd): + if subprocess.call(cmd) != 0: + raise _InternalException('error running command: ' + ' '.join(cmd)) + + # Returns the full contents of filepath, as a single string. + # If filepath looks like a URL, try to read it that way instead of as + # a path on local storage. + # + # Raises _InternalException if there is a problem. + def _GetFileContents(self, filepath): + if filepath.startswith('http:') or filepath.startswith('https:'): + try: + return urllib2.urlopen(filepath).read() + except urllib2.HTTPError as e: + raise _InternalException('unable to read URL %s: %s' % ( + filepath, e)) + else: + return open(filepath, 'r').read() + + # Returns a dictionary of actual results from actual-results.json file. + # + # The dictionary returned has this format: + # { + # u'imageblur_565.png': [u'bitmap-64bitMD5', 3359963596899141322], + # u'imageblur_8888.png': [u'bitmap-64bitMD5', 4217923806027861152], + # u'shadertext3_8888.png': [u'bitmap-64bitMD5', 3713708307125704716] + # } + # + # If the JSON actual result summary file cannot be loaded, logs a warning + # message and returns None. + # If the JSON actual result summary file can be loaded, but we have + # trouble parsing it, raises an Exception. + # + # params: + # json_url: URL pointing to a JSON actual result summary file + # sections: a list of section names to include in the results, e.g. + # [gm_json.JSONKEY_ACTUALRESULTS_FAILED, + # gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON] ; + # if None, then include ALL sections. + def _GetActualResults(self, json_url, sections=None): + try: + json_contents = self._GetFileContents(json_url) + except _InternalException: + print >> sys.stderr, ( + 'could not read json_url %s ; skipping this platform.' % + json_url) + return None + json_dict = gm_json.LoadFromString(json_contents) + results_to_return = {} + actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS] + if not sections: + sections = actual_results.keys() + for section in sections: + section_results = actual_results[section] + if section_results: + results_to_return.update(section_results) + return results_to_return + + # Rebaseline all tests/types we specified in the constructor, + # within this expectations/gm subdir. + # + # params: + # subdir : e.g. 'base-shuttle-win7-intel-float' + # builder : e.g. 'Test-Win7-ShuttleA-HD2000-x86-Release' + def RebaselineSubdir(self, subdir, builder): + # Read in the actual result summary, and extract all the tests whose + # results we need to update. + actuals_url = '/'.join([self._actuals_base_url, + subdir, builder, subdir, + self._actuals_filename]) + # In most cases, we won't need to re-record results that are already + # succeeding, but including the SUCCEEDED results will allow us to + # re-record expectations if they somehow get out of sync. + sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED, + gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED] + if self._add_new: + sections.append(gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON) + results_to_update = self._GetActualResults(json_url=actuals_url, + sections=sections) + + # Read in current expectations. + expectations_input_filepath = os.path.join( + self._expectations_root, subdir, self._expectations_input_filename) + expectations_dict = gm_json.LoadFromFile(expectations_input_filepath) + expected_results = expectations_dict[gm_json.JSONKEY_EXPECTEDRESULTS] + + # Update the expectations in memory, skipping any tests/configs that + # the caller asked to exclude. + skipped_images = [] + if results_to_update: + for (image_name, image_results) in results_to_update.iteritems(): + (test, config) = self._image_filename_re.match(image_name).groups() + if self._tests: + if test not in self._tests: + skipped_images.append(image_name) + continue + if self._configs: + if config not in self._configs: + skipped_images.append(image_name) + continue + if not expected_results.get(image_name): + expected_results[image_name] = {} + expected_results[image_name][gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] = \ [image_results] - # Write out updated expectations. - expectations_output_filepath = os.path.join( - self._expectations_root, subdir, self._expectations_output_filename) - gm_json.WriteToFile(expectations_dict, expectations_output_filepath) + # Write out updated expectations. + expectations_output_filepath = os.path.join( + self._expectations_root, subdir, self._expectations_output_filename) + gm_json.WriteToFile(expectations_dict, expectations_output_filepath) - # Mark the JSON file as plaintext, so text-style diffs can be applied. - # Fixes https://code.google.com/p/skia/issues/detail?id=1442 - if self._using_svn: - self._Call(['svn', 'propset', '--quiet', 'svn:mime-type', - 'text/x-json', expectations_output_filepath]) + # Mark the JSON file as plaintext, so text-style diffs can be applied. + # Fixes https://code.google.com/p/skia/issues/detail?id=1442 + if self._using_svn: + self._Call(['svn', 'propset', '--quiet', 'svn:mime-type', + 'text/x-json', expectations_output_filepath]) # main... @@ -301,12 +294,6 @@ parser.add_argument('--configs', metavar='CONFIG', nargs='+', '"--configs 565 8888", as a filter over the full set of ' + 'results in ACTUALS_FILENAME; if unspecified, rebaseline ' + '*all* configs that are available.') -# TODO(epoger): The --dry-run argument will no longer be needed once we -# are only rebaselining JSON files. -parser.add_argument('--dry-run', action='store_true', - help='instead of actually downloading files or adding ' + - 'files to checkout, display a list of operations that ' + - 'we would normally perform') parser.add_argument('--expectations-filename', help='filename (under EXPECTATIONS_ROOT) to read ' + 'current expectations from, and to write new ' + @@ -342,58 +329,44 @@ args = parser.parse_args() exception_handler = ExceptionHandler( keep_going_on_failure=args.keep_going_on_failure) if args.subdirs: - subdirs = args.subdirs - missing_json_is_fatal = True + subdirs = args.subdirs + missing_json_is_fatal = True else: - subdirs = sorted(SUBDIR_MAPPING.keys()) - missing_json_is_fatal = False + subdirs = sorted(SUBDIR_MAPPING.keys()) + missing_json_is_fatal = False for subdir in subdirs: - if not subdir in SUBDIR_MAPPING.keys(): - raise Exception(('unrecognized platform subdir "%s"; ' + - 'should be one of %s') % ( - subdir, SUBDIR_MAPPING.keys())) - builder = SUBDIR_MAPPING[subdir] - - # We instantiate different Rebaseliner objects depending - # on whether we are rebaselining an expected-results.json file, or - # individual image files. Different expectations/gm subdirectories may move - # from individual image files to JSON-format expectations at different - # times, so we need to make this determination per subdirectory. - # - # See https://goto.google.com/ChecksumTransitionDetail - expectations_json_file = os.path.join(args.expectations_root, subdir, - args.expectations_filename) - if os.path.isfile(expectations_json_file): - rebaseliner = JsonRebaseliner( - expectations_root=args.expectations_root, - expectations_input_filename=args.expectations_filename, - expectations_output_filename=(args.expectations_filename_output or - args.expectations_filename), - tests=args.tests, configs=args.configs, - actuals_base_url=args.actuals_base_url, - actuals_filename=args.actuals_filename, - exception_handler=exception_handler, - add_new=args.add_new) - else: - # TODO(epoger): When we get rid of the ImageRebaseliner implementation, - # we should raise an Exception in this case (no JSON expectations file - # found to update), to prevent a recurrence of - # https://code.google.com/p/skia/issues/detail?id=1403 ('rebaseline.py - # script fails with misleading output when run outside of gm-expected - # dir') - rebaseliner = rebaseline_imagefiles.ImageRebaseliner( - expectations_root=args.expectations_root, - tests=args.tests, configs=args.configs, - dry_run=args.dry_run, - json_base_url=args.actuals_base_url, - json_filename=args.actuals_filename, - exception_handler=exception_handler, - add_new=args.add_new, - missing_json_is_fatal=missing_json_is_fatal) - + if not subdir in SUBDIR_MAPPING.keys(): + raise Exception(('unrecognized platform subdir "%s"; ' + + 'should be one of %s') % ( + subdir, SUBDIR_MAPPING.keys())) + builder = SUBDIR_MAPPING[subdir] + + # We instantiate different Rebaseliner objects depending + # on whether we are rebaselining an expected-results.json file, or + # individual image files. Different expectations/gm subdirectories may move + # from individual image files to JSON-format expectations at different + # times, so we need to make this determination per subdirectory. + # + # See https://goto.google.com/ChecksumTransitionDetail + expectations_json_file = os.path.join(args.expectations_root, subdir, + args.expectations_filename) + if os.path.isfile(expectations_json_file): + rebaseliner = JsonRebaseliner( + expectations_root=args.expectations_root, + expectations_input_filename=args.expectations_filename, + expectations_output_filename=(args.expectations_filename_output or + args.expectations_filename), + tests=args.tests, configs=args.configs, + actuals_base_url=args.actuals_base_url, + actuals_filename=args.actuals_filename, + exception_handler=exception_handler, + add_new=args.add_new) try: - rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder) + rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder) except BaseException as e: - exception_handler.RaiseExceptionOrContinue(e) + exception_handler.RaiseExceptionOrContinue(e) + else: + exception_handler.RaiseExceptionOrContinue(_InternalException( + 'expectations_json_file %s not found' % expectations_json_file)) exception_handler.ReportAllFailures() diff --git a/tools/rebaseline_imagefiles.py b/tools/rebaseline_imagefiles.py deleted file mode 100755 index 466240773a..0000000000 --- a/tools/rebaseline_imagefiles.py +++ /dev/null @@ -1,291 +0,0 @@ -#!/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. -''' - -''' -Rebaselines GM test results as individual image files -(the "old way", before https://goto.google.com/ChecksumTransitionDetail ). - -Once we have switched our expectations to JSON form for all platforms, -we can delete this file. - -There is a lot of code duplicated between here and rebaseline.py, but -that's fine because we will delete this file soon. - -TODO(epoger): Fix indentation in this file (2-space indents, not 4-space). -''' - -# System-level imports -import os -import re -import subprocess -import sys -import urllib2 - -# Imports from within Skia -# -# We need to add the 'gm' directory, so that we can import gm_json.py within -# that directory. That script allows us to parse the actual-results.json file -# written out by the GM tool. -# Make sure that the 'gm' dir is in the PYTHONPATH, but add it at the *end* -# so any dirs that are already in the PYTHONPATH will be preferred. -# -# This assumes that the 'gm' directory has been checked out as a sibling of -# the 'tools' directory containing this script, which will be the case if -# 'trunk' was checked out as a single unit. -GM_DIRECTORY = os.path.realpath( - os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gm')) -if GM_DIRECTORY not in sys.path: - sys.path.append(GM_DIRECTORY) -import gm_json - - -class CommandFailedException(Exception): - pass - -class ImageRebaseliner(object): - - # params: - # expectations_root: root directory of all expectations - # json_base_url: base URL from which to read json_filename - # json_filename: filename (under json_base_url) from which to read a - # summary of results; typically "actual-results.json" - # exception_handler: reference to rebaseline.ExceptionHandler object - # tests: list of tests to rebaseline, or None if we should rebaseline - # whatever files the JSON results summary file tells us to - # configs: which configs to run for each test, or None if we should - # rebaseline whatever configs the JSON results summary file tells - # us to - # dry_run: if True, instead of actually downloading files or adding - # files to checkout, display a list of operations that - # we would normally perform - # add_new: if True, add expectations for tests which don't have any yet - # missing_json_is_fatal: whether to halt execution if we cannot read a - # JSON actual result summary file - def __init__(self, expectations_root, json_base_url, json_filename, - exception_handler, tests=None, configs=None, dry_run=False, - add_new=False, missing_json_is_fatal=False): - self._expectations_root = expectations_root - self._tests = tests - self._configs = configs - self._json_base_url = json_base_url - self._json_filename = json_filename - self._exception_handler = exception_handler - self._dry_run = dry_run - self._add_new = add_new - self._missing_json_is_fatal = missing_json_is_fatal - self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) - self._is_svn_checkout = ( - os.path.exists(os.path.join(expectations_root, '.svn')) or - os.path.exists(os.path.join(expectations_root, os.pardir, '.svn'))) - self._is_git_checkout = ( - os.path.exists(os.path.join(expectations_root, '.git')) or - os.path.exists(os.path.join(expectations_root, os.pardir, '.git'))) - - # If dry_run is False, execute subprocess.call(cmd). - # If dry_run is True, print the command we would have otherwise run. - # Raises a CommandFailedException if the command fails. - def _Call(self, cmd): - if self._dry_run: - print '%s' % ' '.join(cmd) - return - if subprocess.call(cmd) != 0: - raise CommandFailedException('error running command: ' + - ' '.join(cmd)) - - # Download a single actual result from GoogleStorage. - # Raises an exception if it fails. - def _DownloadFromGoogleStorage(self, infilename, outfilename, all_results): - test_name = self._image_filename_re.match(infilename).group(1) - if not test_name: - raise Exception('unable to find test_name for infilename %s' % - infilename) - try: - hash_type, hash_value = all_results[infilename] - except KeyError: - raise Exception('unable to find filename %s in all_results dict' % - infilename) - except ValueError as e: - raise Exception( - 'ValueError reading filename %s from all_results dict: %s' % ( - infilename, e)) - url = gm_json.CreateGmActualUrl( - test_name=test_name, hash_type=hash_type, hash_digest=hash_value) - try: - self._DownloadFile(source_url=url, dest_filename=outfilename) - except CommandFailedException: - raise Exception('Couldn\'t fetch gs_url %s as outfile %s' % ( - url, outfilename)) - - # Download a single file, raising a CommandFailedException if it fails. - def _DownloadFile(self, source_url, dest_filename): - # Download into a temporary file and then rename it afterwards, - # so that we don't corrupt the existing file if it fails midway thru. - temp_filename = os.path.join(os.path.dirname(dest_filename), - '.temp-' + os.path.basename(dest_filename)) - - # TODO(epoger): Replace calls to "curl"/"mv" (which will only work on - # Unix) with a Python HTTP library (which should work cross-platform) - self._Call([ 'curl', '--fail', '--silent', source_url, - '--output', temp_filename ]) - self._Call([ 'mv', temp_filename, dest_filename ]) - - # Returns the full contents of a URL, as a single string. - # - # Unlike standard URL handling, we allow relative "file:" URLs; - # for example, "file:one/two" resolves to the file ./one/two - # (relative to current working dir) - def _GetContentsOfUrl(self, url): - file_prefix = 'file:' - if url.startswith(file_prefix): - filename = url[len(file_prefix):] - return open(filename, 'r').read() - else: - return urllib2.urlopen(url).read() - - # Returns a dictionary of actual results from actual-results.json file. - # - # The dictionary returned has this format: - # { - # u'imageblur_565.png': [u'bitmap-64bitMD5', 3359963596899141322], - # u'imageblur_8888.png': [u'bitmap-64bitMD5', 4217923806027861152], - # u'shadertext3_8888.png': [u'bitmap-64bitMD5', 3713708307125704716] - # } - # - # If the JSON actual result summary file cannot be loaded, the behavior - # depends on self._missing_json_is_fatal: - # - if true: execution will halt with an exception - # - if false: we will log an error message but return an empty dictionary - # - # params: - # json_url: URL pointing to a JSON actual result summary file - # sections: a list of section names to include in the results, e.g. - # [gm_json.JSONKEY_ACTUALRESULTS_FAILED, - # gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON] ; - # if None, then include ALL sections. - def _GetActualResults(self, json_url, sections=None): - try: - json_contents = self._GetContentsOfUrl(json_url) - except (urllib2.HTTPError, IOError): - message = 'unable to load JSON summary URL %s' % json_url - if self._missing_json_is_fatal: - raise ValueError(message) - else: - print '# %s' % message - return {} - - json_dict = gm_json.LoadFromString(json_contents) - results_to_return = {} - actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS] - if not sections: - sections = actual_results.keys() - for section in sections: - section_results = actual_results[section] - if section_results: - results_to_return.update(section_results) - return results_to_return - - # Returns a list of files that require rebaselining. - # - # Note that this returns a list of FILES, like this: - # ['imageblur_565.png', 'xfermodes_pdf.png'] - # rather than a list of TESTS, like this: - # ['imageblur', 'xfermodes'] - # - # params: - # json_url: URL pointing to a JSON actual result summary file - # add_new: if True, then return files listed in any of these sections: - # - JSONKEY_ACTUALRESULTS_FAILED - # - JSONKEY_ACTUALRESULTS_NOCOMPARISON - # if False, then return files listed in these sections: - # - JSONKEY_ACTUALRESULTS_FAILED - # - def _GetFilesToRebaseline(self, json_url, add_new): - if self._dry_run: - print '' - print '#' - print ('# Getting files to rebaseline from JSON summary URL %s ...' - % json_url) - sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED] - if add_new: - sections.append(gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON) - results_to_rebaseline = self._GetActualResults(json_url=json_url, - sections=sections) - files_to_rebaseline = results_to_rebaseline.keys() - files_to_rebaseline.sort() - print '# ... found files_to_rebaseline %s' % files_to_rebaseline - if self._dry_run: - print '#' - return files_to_rebaseline - - # Rebaseline a single file. - def _RebaselineOneFile(self, expectations_subdir, builder_name, - infilename, outfilename, all_results): - if self._dry_run: - print '' - print '# ' + infilename - - # Download this result image from Google Storage. - # If it fails, an exception will be raised. - self._DownloadFromGoogleStorage(infilename=infilename, - outfilename=outfilename, - all_results=all_results) - - # Add this file to version control (if appropriate). - if self._add_new: - if self._is_svn_checkout: - cmd = [ 'svn', 'add', '--quiet', outfilename ] - self._Call(cmd) - cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', - 'image/png', outfilename ]; - self._Call(cmd) - elif self._is_git_checkout: - cmd = [ 'git', 'add', outfilename ] - self._Call(cmd) - - # Rebaseline all tests/types we specified in the constructor, - # within this gm-expectations subdir. - # - # params: - # subdir : e.g. 'base-shuttle-win7-intel-float' - # builder : e.g. 'Test-Win7-ShuttleA-HD2000-x86-Release' - def RebaselineSubdir(self, subdir, builder): - if not os.path.isdir(os.path.join(self._expectations_root, subdir)): - self._exception_handler.RaiseExceptionOrContinue(Exception(( - 'Could not find "%s" subdir within expectations_root "%s". ' + - 'Are you sure --expectations-root is pointing at a valid ' + - 'gm-expected directory?') % (subdir, self._expectations_root))) - return - - json_url = '/'.join([self._json_base_url, - subdir, builder, subdir, - self._json_filename]) - all_results = self._GetActualResults(json_url=json_url) - filenames = self._GetFilesToRebaseline(json_url=json_url, - add_new=self._add_new) - skipped_files = [] - for filename in filenames: - (test, config) = self._image_filename_re.match(filename).groups() - if self._tests: - if test not in self._tests: - skipped_files.append(filename) - continue - if self._configs: - if config not in self._configs: - skipped_files.append(filename) - continue - outfilename = os.path.join(self._expectations_root, subdir, - filename); - try: - self._RebaselineOneFile(expectations_subdir=subdir, - builder_name=builder, - infilename=filename, - outfilename=outfilename, - all_results=all_results) - except BaseException as e: - self._exception_handler.RaiseExceptionOrContinue(e) diff --git a/tools/tests/rebaseline/input/fake-gm-expected-dir/README b/tools/tests/rebaseline/input/fake-gm-expected-dir/README deleted file mode 100644 index 3958c8c97b..0000000000 --- a/tools/tests/rebaseline/input/fake-gm-expected-dir/README +++ /dev/null @@ -1 +0,0 @@ -This directory pretends to be a checkout of gm-expected, with platform subdirs as expected. diff --git a/tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/README b/tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/README deleted file mode 100644 index f2ef7abeca..0000000000 --- a/tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/README +++ /dev/null @@ -1 +0,0 @@ -pretend gm-expected directory for a single platform diff --git a/tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/README b/tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/README deleted file mode 100644 index f2ef7abeca..0000000000 --- a/tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/README +++ /dev/null @@ -1 +0,0 @@ -pretend gm-expected directory for a single platform diff --git a/tools/tests/rebaseline/output/exercise-bug1403/output-expected/command_line b/tools/tests/rebaseline/output/exercise-bug1403/output-expected/command_line deleted file mode 100644 index 2b717a5951..0000000000 --- a/tools/tests/rebaseline/output/exercise-bug1403/output-expected/command_line +++ /dev/null @@ -1 +0,0 @@ -python tools/rebaseline.py --dry-run --expectations-root tools/tests/rebaseline/input --actuals-base-url file:tools/tests/rebaseline/input/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float diff --git a/tools/tests/rebaseline/output/exercise-bug1403/output-expected/return_value b/tools/tests/rebaseline/output/exercise-bug1403/output-expected/return_value deleted file mode 100644 index d00491fd7e..0000000000 --- a/tools/tests/rebaseline/output/exercise-bug1403/output-expected/return_value +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tools/tests/rebaseline/output/exercise-bug1403/output-expected/stdout b/tools/tests/rebaseline/output/exercise-bug1403/output-expected/stdout deleted file mode 100644 index 04d976411a..0000000000 --- a/tools/tests/rebaseline/output/exercise-bug1403/output-expected/stdout +++ /dev/null @@ -1,2 +0,0 @@ -Could not find "base-android-galaxy-nexus" subdir within expectations_root "tools/tests/rebaseline/input". Are you sure --expectations-root is pointing at a valid gm-expected directory? -Halting at first exception; to keep going, re-run with the --keep-going-on-failure option set. diff --git a/tools/tests/rebaseline/output/subset/output-expected/command_line b/tools/tests/rebaseline/output/subset/output-expected/command_line deleted file mode 100644 index 463a6d6b3c..0000000000 --- a/tools/tests/rebaseline/output/subset/output-expected/command_line +++ /dev/null @@ -1 +0,0 @@ -python tools/rebaseline.py --dry-run --expectations-root tools/tests/rebaseline/input/fake-gm-expected-dir --actuals-base-url file:tools/tests/rebaseline/input/json1 --tests nonexistenttest1 imageblur nonexistenttest2 --configs nonexistentconfig1 8888 nonexistentconfig2 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float diff --git a/tools/tests/rebaseline/output/subset/output-expected/return_value b/tools/tests/rebaseline/output/subset/output-expected/return_value deleted file mode 100644 index 573541ac97..0000000000 --- a/tools/tests/rebaseline/output/subset/output-expected/return_value +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/tools/tests/rebaseline/output/subset/output-expected/stdout b/tools/tests/rebaseline/output/subset/output-expected/stdout deleted file mode 100644 index 0ac803cbba..0000000000 --- a/tools/tests/rebaseline/output/subset/output-expected/stdout +++ /dev/null @@ -1,14 +0,0 @@ - -# -# Getting files to rebaseline from JSON summary URL file:tools/tests/rebaseline/input/json1/base-android-galaxy-nexus/Test-Android-GalaxyNexus-SGX540-Arm7-Debug/base-android-galaxy-nexus/actual-results.json ... -# ... found files_to_rebaseline [u'imageblur_565.png', u'imageblur_8888.png', u'shadertext3_8888.png'] -# - -# imageblur_8888.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/imageblur/4217923806027861152.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_8888.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_8888.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_8888.png - -# -# Getting files to rebaseline from JSON summary URL file:tools/tests/rebaseline/input/json1/base-shuttle-win7-intel-float/Test-Win7-ShuttleA-HD2000-x86-Release/base-shuttle-win7-intel-float/actual-results.json ... -# ... found files_to_rebaseline [] -# diff --git a/tools/tests/rebaseline/output/using-json1-add-new/output-expected/command_line b/tools/tests/rebaseline/output/using-json1-add-new/output-expected/command_line deleted file mode 100644 index 7315a3d20e..0000000000 --- a/tools/tests/rebaseline/output/using-json1-add-new/output-expected/command_line +++ /dev/null @@ -1 +0,0 @@ -python tools/rebaseline.py --dry-run --expectations-root tools/tests/rebaseline/input/fake-gm-expected-dir --actuals-base-url file:tools/tests/rebaseline/input/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float --add-new diff --git a/tools/tests/rebaseline/output/using-json1-add-new/output-expected/return_value b/tools/tests/rebaseline/output/using-json1-add-new/output-expected/return_value deleted file mode 100644 index 573541ac97..0000000000 --- a/tools/tests/rebaseline/output/using-json1-add-new/output-expected/return_value +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/tools/tests/rebaseline/output/using-json1-add-new/output-expected/stdout b/tools/tests/rebaseline/output/using-json1-add-new/output-expected/stdout deleted file mode 100644 index 59b2dc7d39..0000000000 --- a/tools/tests/rebaseline/output/using-json1-add-new/output-expected/stdout +++ /dev/null @@ -1,64 +0,0 @@ - -# -# Getting files to rebaseline from JSON summary URL file:tools/tests/rebaseline/input/json1/base-android-galaxy-nexus/Test-Android-GalaxyNexus-SGX540-Arm7-Debug/base-android-galaxy-nexus/actual-results.json ... -# ... found files_to_rebaseline [u'3x3bitmaprect_565.png', u'3x3bitmaprect_8888.png', u'imageblur_565.png', u'imageblur_8888.png', u'shadertext3_8888.png', u'xfermodeimagefilter_pdf.png'] -# - -# 3x3bitmaprect_565.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/3x3bitmaprect/16998423976396106083.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-3x3bitmaprect_565.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-3x3bitmaprect_565.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/3x3bitmaprect_565.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/3x3bitmaprect_565.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/3x3bitmaprect_565.png - -# 3x3bitmaprect_8888.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/3x3bitmaprect/2054956815327187963.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-3x3bitmaprect_8888.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-3x3bitmaprect_8888.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/3x3bitmaprect_8888.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/3x3bitmaprect_8888.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/3x3bitmaprect_8888.png - -# imageblur_565.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/imageblur/3359963596899141322.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_565.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_565.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_565.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_565.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_565.png - -# imageblur_8888.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/imageblur/4217923806027861152.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_8888.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_8888.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_8888.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_8888.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_8888.png - -# shadertext3_8888.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/shadertext3/3713708307125704716.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-shadertext3_8888.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-shadertext3_8888.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/shadertext3_8888.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/shadertext3_8888.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/shadertext3_8888.png - -# xfermodeimagefilter_pdf.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/xfermodeimagefilter/16502178848783208088.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-xfermodeimagefilter_pdf.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-xfermodeimagefilter_pdf.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/xfermodeimagefilter_pdf.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/xfermodeimagefilter_pdf.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/xfermodeimagefilter_pdf.png - -# -# Getting files to rebaseline from JSON summary URL file:tools/tests/rebaseline/input/json1/base-shuttle-win7-intel-float/Test-Win7-ShuttleA-HD2000-x86-Release/base-shuttle-win7-intel-float/actual-results.json ... -# ... found files_to_rebaseline [u'3x3bitmaprect_565.png', u'3x3bitmaprect_8888.png', u'xfermodeimagefilter_pdf.png'] -# - -# 3x3bitmaprect_565.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/3x3bitmaprect/16998423976396106083.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/.temp-3x3bitmaprect_565.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/.temp-3x3bitmaprect_565.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/3x3bitmaprect_565.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/3x3bitmaprect_565.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/3x3bitmaprect_565.png - -# 3x3bitmaprect_8888.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/3x3bitmaprect/2054956815327187963.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/.temp-3x3bitmaprect_8888.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/.temp-3x3bitmaprect_8888.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/3x3bitmaprect_8888.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/3x3bitmaprect_8888.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/3x3bitmaprect_8888.png - -# xfermodeimagefilter_pdf.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/xfermodeimagefilter/16502178848783208088.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/.temp-xfermodeimagefilter_pdf.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/.temp-xfermodeimagefilter_pdf.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/xfermodeimagefilter_pdf.png -svn add --quiet tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/xfermodeimagefilter_pdf.png -svn propset --quiet svn:mime-type image/png tools/tests/rebaseline/input/fake-gm-expected-dir/base-shuttle-win7-intel-float/xfermodeimagefilter_pdf.png diff --git a/tools/tests/rebaseline/output/using-json1/output-expected/command_line b/tools/tests/rebaseline/output/using-json1/output-expected/command_line deleted file mode 100644 index d798943563..0000000000 --- a/tools/tests/rebaseline/output/using-json1/output-expected/command_line +++ /dev/null @@ -1 +0,0 @@ -python tools/rebaseline.py --dry-run --expectations-root tools/tests/rebaseline/input/fake-gm-expected-dir --actuals-base-url file:tools/tests/rebaseline/input/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float diff --git a/tools/tests/rebaseline/output/using-json1/output-expected/return_value b/tools/tests/rebaseline/output/using-json1/output-expected/return_value deleted file mode 100644 index 573541ac97..0000000000 --- a/tools/tests/rebaseline/output/using-json1/output-expected/return_value +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/tools/tests/rebaseline/output/using-json1/output-expected/stdout b/tools/tests/rebaseline/output/using-json1/output-expected/stdout deleted file mode 100644 index e7b2906c70..0000000000 --- a/tools/tests/rebaseline/output/using-json1/output-expected/stdout +++ /dev/null @@ -1,22 +0,0 @@ - -# -# Getting files to rebaseline from JSON summary URL file:tools/tests/rebaseline/input/json1/base-android-galaxy-nexus/Test-Android-GalaxyNexus-SGX540-Arm7-Debug/base-android-galaxy-nexus/actual-results.json ... -# ... found files_to_rebaseline [u'imageblur_565.png', u'imageblur_8888.png', u'shadertext3_8888.png'] -# - -# imageblur_565.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/imageblur/3359963596899141322.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_565.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_565.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_565.png - -# imageblur_8888.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/imageblur/4217923806027861152.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_8888.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-imageblur_8888.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/imageblur_8888.png - -# shadertext3_8888.png -curl --fail --silent http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitmap-64bitMD5/shadertext3/3713708307125704716.png --output tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-shadertext3_8888.png -mv tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/.temp-shadertext3_8888.png tools/tests/rebaseline/input/fake-gm-expected-dir/base-android-galaxy-nexus/shadertext3_8888.png - -# -# Getting files to rebaseline from JSON summary URL file:tools/tests/rebaseline/input/json1/base-shuttle-win7-intel-float/Test-Win7-ShuttleA-HD2000-x86-Release/base-shuttle-win7-intel-float/actual-results.json ... -# ... found files_to_rebaseline [] -# diff --git a/tools/tests/run.sh b/tools/tests/run.sh index 997e5e8d62..b36c1e2807 100755 --- a/tools/tests/run.sh +++ b/tools/tests/run.sh @@ -129,30 +129,7 @@ function benchgraph_test { compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR } -# Test rebaseline.py's soon-to-disappear image file rebaselining capability. -# -# Run rebaseline.py with arguments in $1, recording its dry-run output. -# Then compare that dry-run output to the content of $2/output-expected. -function rebaseline_images_test { - if [ $# != 2 ]; then - echo "rebaseline_test requires exactly 2 parameters, got $#" - exit 1 - fi - ARGS="$1" - ACTUAL_OUTPUT_DIR="$2/output-actual" - EXPECTED_OUTPUT_DIR="$2/output-expected" - - rm -rf $ACTUAL_OUTPUT_DIR - mkdir -p $ACTUAL_OUTPUT_DIR - COMMAND="python tools/rebaseline.py --dry-run $ARGS" - echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line - $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout - echo $? >$ACTUAL_OUTPUT_DIR/return_value - - compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR -} - -# Test rebaseline.py's new JSON-format expectations rebaselining capability. +# Test rebaseline.py's JSON-format expectations rebaselining capability. # # Copy expected-result.json files from $1 into a dir where they can be modified. # Run rebaseline.py with arguments in $2, recording its output. @@ -265,14 +242,6 @@ fi REBASELINE_INPUT=tools/tests/rebaseline/input REBASELINE_OUTPUT=tools/tests/rebaseline/output - -# These test the old image-file expectations. -rebaseline_images_test "--expectations-root $REBASELINE_INPUT/fake-gm-expected-dir --actuals-base-url file:$REBASELINE_INPUT/json1 --tests nonexistenttest1 imageblur nonexistenttest2 --configs nonexistentconfig1 8888 nonexistentconfig2 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/subset" -rebaseline_images_test "--expectations-root $REBASELINE_INPUT/fake-gm-expected-dir --actuals-base-url file:$REBASELINE_INPUT/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/using-json1" -rebaseline_images_test "--expectations-root $REBASELINE_INPUT/fake-gm-expected-dir --actuals-base-url file:$REBASELINE_INPUT/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float --add-new" "$REBASELINE_OUTPUT/using-json1-add-new" -rebaseline_images_test "--expectations-root $REBASELINE_INPUT --actuals-base-url file:$REBASELINE_INPUT/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/exercise-bug1403" - -# These test the new JSON-format expectations. rebaseline_test "$REBASELINE_INPUT/json1" "--actuals-base-url $REBASELINE_INPUT/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float" "$REBASELINE_OUTPUT/using-json1-expectations" # |