From 123a0b5fbf2e72e8d322a7215db05bb24bfd3cdc Mon Sep 17 00:00:00 2001 From: "senorblanco@chromium.org" Date: Thu, 29 Nov 2012 21:50:34 +0000 Subject: rebaseline.py: Allow multiple testnames on the command line. Review URL: https://codereview.appspot.com/6856118 git-svn-id: http://skia.googlecode.com/svn/trunk@6623 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tools/rebaseline.py | 67 +++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/tools/rebaseline.py b/tools/rebaseline.py index e907c75e70..a36dbc7376 100755 --- a/tools/rebaseline.py +++ b/tools/rebaseline.py @@ -8,8 +8,9 @@ found in the LICENSE file. ''' ''' -Rebaselines a single GM test, on all bots and all configurations. -Must be run from an SVN checkout of the gm-expected directory. +Rebaselines the given GM tests, on all bots and all configurations. +Must be run from the gm-expected directory. If run from a git or SVN +checkout, the files will be added to the staging area for commit. ''' import os, subprocess, sys, tempfile @@ -37,40 +38,40 @@ pairs = [ 'Skia_Xoom_4-1_Float_Release_32'], ] -if len(sys.argv) != 2: - print 'Usage: ' + os.path.basename(sys.argv[0]) + ' ' +if len(sys.argv) < 2: + print 'Usage: ' + os.path.basename(sys.argv[0]) + ' ' + '[ ... ]' exit(1) -testname = sys.argv[1] - is_svn_checkout = os.path.exists(os.path.join('..', '.svn')) is_git_checkout = os.path.exists(os.path.join('..', '.git')) -for pair in pairs: - if (pair[0] == 'base-shuttle-win7-intel-angle'): - testtypes = [ 'angle' ] - else: - testtypes = [ '4444', '565', '8888', 'gpu', 'pdf' ] - print pair[0] + ':' - for testtype in testtypes: - infilename = testname + '_' + testtype + '.png' - print infilename +for testname in sys.argv[1:]: + for pair in pairs: + if (pair[0] == 'base-shuttle-win7-intel-angle'): + testtypes = [ 'angle' ] + else: + testtypes = [ '4444', '565', '8888', 'gpu', 'pdf' ] + print pair[0] + ':' + for testtype in testtypes: + infilename = testname + '_' + testtype + '.png' + print infilename - url = 'http://skia-autogen.googlecode.com/svn/gm-actual/' + pair[0] + '/' + pair[1] + '/' + pair[0] + '/' + infilename - cmd = [ 'curl', '--fail', '--silent', url ] - temp = tempfile.NamedTemporaryFile() - ret = subprocess.call(cmd, stdout=temp) - if ret != 0: - print 'Couldn\'t fetch ' + url - continue - outfilename = os.path.join(pair[0], infilename); - cmd = [ 'cp', temp.name, outfilename ] - subprocess.call(cmd); - if is_svn_checkout: - cmd = [ 'svn', 'add', '--quiet', outfilename ] - subprocess.call(cmd) - cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png', outfilename ]; - subprocess.call(cmd) - elif is_git_checkout: - cmd = [ 'git', 'add', outfilename ] - subprocess.call(cmd) + url = 'http://skia-autogen.googlecode.com/svn/gm-actual/' + pair[0] + '/' + pair[1] + '/' + pair[0] + '/' + infilename + cmd = [ 'curl', '--fail', '--silent', url ] + temp = tempfile.NamedTemporaryFile() + ret = subprocess.call(cmd, stdout=temp) + if ret != 0: + print 'Couldn\'t fetch ' + url + continue + outfilename = os.path.join(pair[0], infilename); + cmd = [ 'cp', temp.name, outfilename ] + subprocess.call(cmd); + if is_svn_checkout: + cmd = [ 'svn', 'add', '--quiet', outfilename ] + subprocess.call(cmd) + cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png', outfilename ]; + subprocess.call(cmd) + elif is_git_checkout: + cmd = [ 'git', 'add', outfilename ] + subprocess.call(cmd) -- cgit v1.2.3