blob: 56e6380b64dc904931e3fa8525fdc52bd48a8c6d [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',
borenet@google.come6598a02013-04-30 12:02:32 +000020 'Test-Win7-ShuttleA-HD2000-x86-Release'],
senorblanco@chromium.org5682f212012-10-30 14:34:55 +000021 ['base-shuttle-win7-intel-angle',
borenet@google.come6598a02013-04-30 12:02:32 +000022 'Test-Win7-ShuttleA-HD2000-x86-Release-ANGLE'],
senorblanco@chromium.org5682f212012-10-30 14:34:55 +000023 ['base-shuttle-win7-intel-directwrite',
borenet@google.come6598a02013-04-30 12:02:32 +000024 'Test-Win7-ShuttleA-HD2000-x86-Release-DirectWrite'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000025 ['base-shuttle_ubuntu12_ati5770',
borenet@google.come6598a02013-04-30 12:02:32 +000026 'Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000027 ['base-macmini',
borenet@google.come6598a02013-04-30 12:02:32 +000028 'Test-Mac10.6-MacMini4.1-GeForce320M-x86-Release'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000029 ['base-macmini-lion-float',
borenet@google.come6598a02013-04-30 12:02:32 +000030 'Test-Mac10.7-MacMini4.1-GeForce320M-x86-Release'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000031 ['base-android-galaxy-nexus',
bsalomon@google.comcb3c8d72013-05-03 20:24:54 +000032 'Test-Android-GalaxyNexus-SGX540-Arm7-Debug'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000033 ['base-android-nexus-7',
borenet@google.come6598a02013-04-30 12:02:32 +000034 'Test-Android-Nexus7-Tegra3-Arm7-Release'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000035 ['base-android-nexus-s',
borenet@google.come6598a02013-04-30 12:02:32 +000036 'Test-Android-NexusS-SGX540-Arm7-Release'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000037 ['base-android-xoom',
borenet@google.come6598a02013-04-30 12:02:32 +000038 'Test-Android-Xoom-Tegra2-Arm7-Release'],
bsalomon@google.com3c587232013-05-14 18:20:00 +000039 ['base-android-nexus-10',
40 'Test-Android-Nexus10-MaliT604-Arm7-Release'],
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000041]
42
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000043if len(sys.argv) < 2:
44 print 'Usage: ' + os.path.basename(sys.argv[0]) + ' <testname> '
45 '[ <testname> ... ]'
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000046 exit(1)
47
senorblanco@chromium.org0b6dc192012-12-07 17:19:07 +000048is_svn_checkout = os.path.exists('.svn') or os.path.exists(os.path.join('..', '.svn') )
49is_git_checkout = os.path.exists('.git') or os.path.exists(os.path.join('..', '.git'))
senorblanco@chromium.org79fc6fc2012-11-07 22:32:12 +000050
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000051for testname in sys.argv[1:]:
52 for pair in pairs:
53 if (pair[0] == 'base-shuttle-win7-intel-angle'):
bsalomon@google.com7d01ec42013-05-17 14:10:59 +000054 testtypes = [ 'angle', 'anglemsaa16' ]
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000055 else:
bsalomon@google.com7d01ec42013-05-17 14:10:59 +000056 testtypes = [ '565', '8888', 'gpu', 'pdf', 'mesa', 'msaa16', 'msaa4' ]
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000057 print pair[0] + ':'
58 for testtype in testtypes:
59 infilename = testname + '_' + testtype + '.png'
60 print infilename
senorblanco@chromium.org782f3b42012-10-29 18:06:26 +000061
senorblanco@chromium.org123a0b52012-11-29 21:50:34 +000062 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)