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

Side by Side Diff: tools/rebaseline.py

Issue 16160008: Refactor rebaseline.py into functions ; no behavioral changes. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: add_a_sort Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 2012 Google Inc. 4 Copyright 2012 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 9
10 ''' 10 '''
11 Rebaselines the given GM tests, on all bots and all configurations. 11 Rebaselines the given GM tests, on all bots and all configurations.
12 Must be run from the gm-expected directory. If run from a git or SVN 12 Must be run from the gm-expected directory. If run from a git or SVN
13 checkout, the files will be added to the staging area for commit. 13 checkout, the files will be added to the staging area for commit.
14 ''' 14 '''
15 15
16 import os, subprocess, sys, tempfile 16 import os
17 import subprocess
18 import sys
19 import tempfile
17 20
18 pairs = [ 21 # Mapping of gm-expectations subdir (under
19 ['base-shuttle-win7-intel-float', 22 # https://skia.googlecode.com/svn/gm-expected/ )
20 'Test-Win7-ShuttleA-HD2000-x86-Release'], 23 # to builder name (see list at http://108.170.217.252:10117/builders )
21 ['base-shuttle-win7-intel-angle', 24 subdir_mapping = {
22 'Test-Win7-ShuttleA-HD2000-x86-Release-ANGLE'], 25 'base-shuttle-win7-intel-float':
23 ['base-shuttle-win7-intel-directwrite', 26 'Test-Win7-ShuttleA-HD2000-x86-Release',
24 'Test-Win7-ShuttleA-HD2000-x86-Release-DirectWrite'], 27 'base-shuttle-win7-intel-angle':
25 ['base-shuttle_ubuntu12_ati5770', 28 'Test-Win7-ShuttleA-HD2000-x86-Release-ANGLE',
26 'Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release'], 29 'base-shuttle-win7-intel-directwrite':
27 ['base-macmini', 30 'Test-Win7-ShuttleA-HD2000-x86-Release-DirectWrite',
28 'Test-Mac10.6-MacMini4.1-GeForce320M-x86-Release'], 31 'base-shuttle_ubuntu12_ati5770':
29 ['base-macmini-lion-float', 32 'Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release',
30 'Test-Mac10.7-MacMini4.1-GeForce320M-x86-Release'], 33 'base-macmini':
31 ['base-android-galaxy-nexus', 34 'Test-Mac10.6-MacMini4.1-GeForce320M-x86-Release',
32 'Test-Android-GalaxyNexus-SGX540-Arm7-Debug'], 35 'base-macmini-lion-float':
33 ['base-android-nexus-7', 36 'Test-Mac10.7-MacMini4.1-GeForce320M-x86-Release',
34 'Test-Android-Nexus7-Tegra3-Arm7-Release'], 37 'base-android-galaxy-nexus':
35 ['base-android-nexus-s', 38 'Test-Android-GalaxyNexus-SGX540-Arm7-Debug',
36 'Test-Android-NexusS-SGX540-Arm7-Release'], 39 'base-android-nexus-7':
37 ['base-android-xoom', 40 'Test-Android-Nexus7-Tegra3-Arm7-Release',
38 'Test-Android-Xoom-Tegra2-Arm7-Release'], 41 'base-android-nexus-s':
39 ['base-android-nexus-10', 42 'Test-Android-NexusS-SGX540-Arm7-Release',
40 'Test-Android-Nexus10-MaliT604-Arm7-Release'], 43 'base-android-xoom':
41 ] 44 'Test-Android-Xoom-Tegra2-Arm7-Release',
45 'base-android-nexus-10':
46 'Test-Android-Nexus10-MaliT604-Arm7-Release',
47 }
48
49 IS_SVN_CHECKOUT = (os.path.exists('.svn') or
50 os.path.exists(os.path.join('..', '.svn')))
51 IS_GIT_CHECKOUT = (os.path.exists('.git') or
52 os.path.exists(os.path.join('..', '.git')))
53
54
55 # Rebaseline a single file.
56 def RebaselineOneFile(expectations_subdir, builder_name,
57 infilename, outfilename):
58 url = ('http://skia-autogen.googlecode.com/svn/gm-actual/' +
59 expectations_subdir + '/' + builder_name + '/' +
60 expectations_subdir + '/' + infilename)
61 cmd = [ 'curl', '--fail', '--silent', url ]
62 temp = tempfile.NamedTemporaryFile()
63 ret = subprocess.call(cmd, stdout=temp)
64 if ret != 0:
65 print 'Couldn\'t fetch ' + url
66 return
67 cmd = [ 'cp', temp.name, outfilename ]
68 subprocess.call(cmd);
69 if IS_SVN_CHECKOUT:
70 cmd = [ 'svn', 'add', '--quiet', outfilename ]
71 subprocess.call(cmd)
72 cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png',
73 outfilename ];
74 subprocess.call(cmd)
75 elif IS_GIT_CHECKOUT:
76 cmd = [ 'git', 'add', outfilename ]
77 subprocess.call(cmd)
78
79
80 # Rebaseline all testtypes for a single test.
81 def RebaselineOneTest(expectations_subdir, builder_name, testname):
82 if (expectations_subdir == 'base-shuttle-win7-intel-angle'):
83 testtypes = [ 'angle', 'anglemsaa16' ]
84 else:
85 testtypes = [ '565', '8888', 'gpu', 'pdf', 'mesa', 'msaa16', 'msaa4' ]
86 print expectations_subdir + ':'
87 for testtype in testtypes:
88 infilename = testname + '_' + testtype + '.png'
89 print infilename
90 outfilename = os.path.join(expectations_subdir, infilename);
91 RebaselineOneFile(expectations_subdir=expectations_subdir,
92 builder_name=builder_name,
93 infilename=infilename,
94 outfilename=outfilename)
95
96
42 97
43 if len(sys.argv) < 2: 98 if len(sys.argv) < 2:
44 print 'Usage: ' + os.path.basename(sys.argv[0]) + ' <testname> ' 99 print ('Usage: ' + os.path.basename(sys.argv[0]) +
45 '[ <testname> ... ]' 100 ' <testname> [ <testname> ... ]')
46 exit(1) 101 exit(1)
47 102
48 is_svn_checkout = os.path.exists('.svn') or os.path.exists(os.path.join('..', '. svn') )
49 is_git_checkout = os.path.exists('.git') or os.path.exists(os.path.join('..', '. git'))
50
51 for testname in sys.argv[1:]: 103 for testname in sys.argv[1:]:
52 for pair in pairs: 104 for expectations_subdir in sorted(subdir_mapping.keys()):
epoger 2013/05/29 17:09:35 Patchset 3 iterates over the platforms in determin
53 if (pair[0] == 'base-shuttle-win7-intel-angle'): 105 builder_name = subdir_mapping[expectations_subdir]
54 testtypes = [ 'angle', 'anglemsaa16' ] 106 RebaselineOneTest(expectations_subdir=expectations_subdir,
55 else: 107 builder_name=builder_name,
56 testtypes = [ '565', '8888', 'gpu', 'pdf', 'mesa', 'msaa16', 'msaa4' ] 108 testname=testname)
57 print pair[0] + ':'
58 for testtype in testtypes:
59 infilename = testname + '_' + testtype + '.png'
60 print infilename
61
62 url = 'http://skia-autogen.googlecode.com/svn/gm-actual/' + pair[0] + '/' + pair[1] + '/' + pair[0] + '/' + infilename
63 cmd = [ 'curl', '--fail', '--silent', url ]
64 temp = tempfile.NamedTemporaryFile()
65 ret = subprocess.call(cmd, stdout=temp)
66 if ret != 0:
67 print 'Couldn\'t fetch ' + url
68 continue
69 outfilename = os.path.join(pair[0], infilename);
70 cmd = [ 'cp', temp.name, outfilename ]
71 subprocess.call(cmd);
72 if is_svn_checkout:
73 cmd = [ 'svn', 'add', '--quiet', outfilename ]
74 subprocess.call(cmd)
75 cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png ', outfilename ];
76 subprocess.call(cmd)
77 elif is_git_checkout:
78 cmd = [ 'git', 'add', outfilename ]
79 subprocess.call(cmd)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698