senorblanco@chromium.org | 782f3b4 | 2012-10-29 18:06:26 +0000 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | ''' |
| 4 | Copyright 2012 Google Inc. |
| 5 | |
| 6 | Use of this source code is governed by a BSD-style license that can be |
| 7 | found in the LICENSE file. |
| 8 | ''' |
| 9 | |
| 10 | ''' |
senorblanco@chromium.org | 123a0b5 | 2012-11-29 21:50:34 +0000 | [diff] [blame] | 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 |
| 13 | checkout, the files will be added to the staging area for commit. |
senorblanco@chromium.org | 782f3b4 | 2012-10-29 18:06:26 +0000 | [diff] [blame] | 14 | ''' |
| 15 | |
| 16 | import os, subprocess, sys, tempfile |
| 17 | |
| 18 | pairs = [ |
| 19 | ['base-shuttle-win7-intel-float', |
| 20 | 'Skia_Shuttle_Win7_Intel_Float_Release_32'], |
senorblanco@chromium.org | 5682f21 | 2012-10-30 14:34:55 +0000 | [diff] [blame] | 21 | ['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.org | 782f3b4 | 2012-10-29 18:06:26 +0000 | [diff] [blame] | 25 | ['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.org | 123a0b5 | 2012-11-29 21:50:34 +0000 | [diff] [blame] | 41 | if len(sys.argv) < 2: |
| 42 | print 'Usage: ' + os.path.basename(sys.argv[0]) + ' <testname> ' |
| 43 | '[ <testname> ... ]' |
senorblanco@chromium.org | 782f3b4 | 2012-10-29 18:06:26 +0000 | [diff] [blame] | 44 | exit(1) |
| 45 | |
senorblanco@chromium.org | 0b6dc19 | 2012-12-07 17:19:07 +0000 | [diff] [blame] | 46 | is_svn_checkout = os.path.exists('.svn') or os.path.exists(os.path.join('..', '.svn') ) |
| 47 | is_git_checkout = os.path.exists('.git') or os.path.exists(os.path.join('..', '.git')) |
senorblanco@chromium.org | 79fc6fc | 2012-11-07 22:32:12 +0000 | [diff] [blame] | 48 | |
senorblanco@chromium.org | 123a0b5 | 2012-11-29 21:50:34 +0000 | [diff] [blame] | 49 | for 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.org | 0b6dc19 | 2012-12-07 17:19:07 +0000 | [diff] [blame] | 54 | testtypes = [ '565', '8888', 'gpu', 'pdf', 'mesa' ] |
senorblanco@chromium.org | 123a0b5 | 2012-11-29 21:50:34 +0000 | [diff] [blame] | 55 | print pair[0] + ':' |
| 56 | for testtype in testtypes: |
| 57 | infilename = testname + '_' + testtype + '.png' |
| 58 | print infilename |
senorblanco@chromium.org | 782f3b4 | 2012-10-29 18:06:26 +0000 | [diff] [blame] | 59 | |
senorblanco@chromium.org | 123a0b5 | 2012-11-29 21:50:34 +0000 | [diff] [blame] | 60 | 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) |