blob: 21964d4a33a6c96299ee76271090e6067849bd4f [file] [log] [blame]
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +00001#!/usr/bin/python
2
3'''
4Copyright 2012 Google Inc.
5
6Use of this source code is governed by a BSD-style license that can be
7found in the LICENSE file.
8'''
9
10'''
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000011Rebaselines the given GM tests, on all bots and all configurations.
12Must be run from the gm-expected directory. If run from a git or SVN
13checkout, the files will be added to the staging area for commit.
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000014'''
15
16import os, subprocess, sys, tempfile
17
18pairs = [
19 ['base-shuttle-win7-intel-float',
20 'Skia_Shuttle_Win7_Intel_Float_Release_32'],
senorblanco@chromium.org5682f212012-10-30 14:34:55 +000021 ['base-shuttle-win7-intel-angle',
22 'Skia_Shuttle_Win7_Intel_Float_ANGLE_Release_32'],
23 ['base-shuttle-win7-intel-directwrite',
24 'Skia_Shuttle_Win7_Intel_Float_DirectWrite_Release_32'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000025 ['base-shuttle_ubuntu12_ati5770',
26 'Skia_Shuttle_Ubuntu12_ATI5770_Float_Release_64'],
27 ['base-macmini',
28 'Skia_Mac_Float_Release_32'],
29 ['base-macmini-lion-float',
30 'Skia_MacMiniLion_Float_Release_32'],
31 ['base-android-galaxy-nexus',
32 'Skia_GalaxyNexus_4-1_Float_Release_32'],
33 ['base-android-nexus-7',
34 'Skia_Nexus7_4-1_Float_Release_32'],
35 ['base-android-nexus-s',
36 'Skia_NexusS_4-1_Float_Release_32'],
37 ['base-android-xoom',
38 'Skia_Xoom_4-1_Float_Release_32'],
39]
40
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000041if len(sys.argv) < 2:
42 print 'Usage: ' + os.path.basename(sys.argv[0]) + ' <testname> '
43 '[ <testname> ... ]'
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000044 exit(1)
45
senorblanco@chromium.org0b6dc192012-12-07 17:19:07 +000046is_svn_checkout = os.path.exists('.svn') or os.path.exists(os.path.join('..', '.svn') )
47is_git_checkout = os.path.exists('.git') or os.path.exists(os.path.join('..', '.git'))
senorblanco@chromium.org79fc6fc2012-11-07 22:32:12 +000048
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000049for testname in sys.argv[1:]:
50 for pair in pairs:
51 if (pair[0] == 'base-shuttle-win7-intel-angle'):
52 testtypes = [ 'angle' ]
53 else:
senorblanco@chromium.org0b6dc192012-12-07 17:19:07 +000054 testtypes = [ '565', '8888', 'gpu', 'pdf', 'mesa' ]
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000055 print pair[0] + ':'
56 for testtype in testtypes:
57 infilename = testname + '_' + testtype + '.png'
58 print infilename
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000059
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000060 url = 'http://skia-autogen.googlecode.com/svn/gm-actual/' + pair[0] + '/' + pair[1] + '/' + pair[0] + '/' + 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 continue
67 outfilename = os.path.join(pair[0], infilename);
68 cmd = [ 'cp', temp.name, outfilename ]
69 subprocess.call(cmd);
70 if is_svn_checkout:
71 cmd = [ 'svn', 'add', '--quiet', outfilename ]
72 subprocess.call(cmd)
73 cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png', outfilename ];
74 subprocess.call(cmd)
75 elif is_git_checkout:
76 cmd = [ 'git', 'add', outfilename ]
77 subprocess.call(cmd)