33# Use of this source code is governed by a BSD-style license that can be
44# found in the LICENSE file.
55
6-
76"""Argument-less script to select what to run on the buildbots."""
87
9-
108import os
119import shutil
1210import subprocess
1311import sys
1412
1513
16- if sys .platform in ['win32' , 'cygwin' ]:
17- EXE_SUFFIX = '.exe'
18- else :
19- EXE_SUFFIX = ''
20-
21-
2214BUILDBOT_DIR = os .path .dirname (os .path .abspath (__file__ ))
2315TRUNK_DIR = os .path .dirname (BUILDBOT_DIR )
2416ROOT_DIR = os .path .dirname (TRUNK_DIR )
25- ANDROID_DIR = os .path .join (ROOT_DIR , 'android' )
2617CMAKE_DIR = os .path .join (ROOT_DIR , 'cmake' )
2718CMAKE_BIN_DIR = os .path .join (CMAKE_DIR , 'bin' )
2819OUT_DIR = os .path .join (TRUNK_DIR , 'out' )
2920
3021
3122def CallSubProcess (* args , ** kwargs ):
3223 """Wrapper around subprocess.call which treats errors as build exceptions."""
33- retcode = subprocess .call (* args , ** kwargs )
24+ with open (os .devnull ) as devnull_fd :
25+ retcode = subprocess .call (stdin = devnull_fd , * args , ** kwargs )
3426 if retcode != 0 :
3527 print '@@@STEP_EXCEPTION@@@'
3628 sys .exit (1 )
@@ -49,10 +41,6 @@ def PrepareCmake():
4941
5042 print '@@@BUILD_STEP Initialize CMake checkout@@@'
5143 os .mkdir (CMAKE_DIR )
52- CallSubProcess (['git' , 'config' , '--global' , 'user.name' , 'trybot' ])
53- CallSubProcess (['git' , 'config' , '--global' ,
54- 'user.email' ,
'[email protected] ' ])
55- CallSubProcess (['git' , 'config' , '--global' , 'color.ui' , 'false' ])
5644
5745 print '@@@BUILD_STEP Sync CMake@@@'
5846 CallSubProcess (
@@ -73,41 +61,7 @@ def PrepareCmake():
7361 CallSubProcess ( ['make' , 'cmake' ], cwd = CMAKE_DIR )
7462
7563
76- def PrepareAndroidTree ():
77- """Prepare an Android tree to run 'android' format tests."""
78- if os .environ ['BUILDBOT_CLOBBER' ] == '1' :
79- print '@@@BUILD_STEP Clobber Android checkout@@@'
80- shutil .rmtree (ANDROID_DIR )
81-
82- # The release of Android we use is static, so there's no need to do anything
83- # if the directory already exists.
84- if os .path .isdir (ANDROID_DIR ):
85- return
86-
87- print '@@@BUILD_STEP Initialize Android checkout@@@'
88- os .mkdir (ANDROID_DIR )
89- CallSubProcess (['git' , 'config' , '--global' , 'user.name' , 'trybot' ])
90- CallSubProcess (['git' , 'config' , '--global' ,
91- 'user.email' ,
'[email protected] ' ])
92- CallSubProcess (['git' , 'config' , '--global' , 'color.ui' , 'false' ])
93- CallSubProcess (
94- ['repo' , 'init' ,
95- '-u' , 'https://android.googlesource.com/platform/manifest' ,
96- '-b' , 'android-4.2.1_r1' ,
97- '-g' , 'all,-notdefault,-device,-darwin,-mips,-x86' ],
98- cwd = ANDROID_DIR )
99-
100- print '@@@BUILD_STEP Sync Android@@@'
101- CallSubProcess (['repo' , 'sync' , '-j4' ], cwd = ANDROID_DIR )
102-
103- print '@@@BUILD_STEP Build Android@@@'
104- CallSubProcess (
105- ['/bin/bash' ,
106- '-c' , 'source build/envsetup.sh && lunch full-eng && make -j4' ],
107- cwd = ANDROID_DIR )
108-
109-
110- def GypTestFormat (title , format = None , msvs_version = None ):
64+ def GypTestFormat (title , format = None , msvs_version = None , tests = []):
11165 """Run the gyp tests for a given format, emitting annotator tags.
11266
11367 See annotator docs at:
@@ -126,22 +80,13 @@ def GypTestFormat(title, format=None, msvs_version=None):
12680 if msvs_version :
12781 env ['GYP_MSVS_VERSION' ] = msvs_version
12882 command = ' ' .join (
129- [sys .executable , 'trunk /gyptest.py' ,
83+ [sys .executable , 'gyp /gyptest.py' ,
13084 '--all' ,
13185 '--passed' ,
13286 '--format' , format ,
13387 '--path' , CMAKE_BIN_DIR ,
134- '--chdir' , 'trunk' ])
135- if format == 'android' :
136- # gyptest needs the environment setup from envsetup/lunch in order to build
137- # using the 'android' backend, so this is done in a single shell.
138- retcode = subprocess .call (
139- ['/bin/bash' ,
140- '-c' , 'source build/envsetup.sh && lunch full-eng && cd %s && %s'
141- % (ROOT_DIR , command )],
142- cwd = ANDROID_DIR , env = env )
143- else :
144- retcode = subprocess .call (command , cwd = ROOT_DIR , env = env , shell = True )
88+ '--chdir' , 'gyp' ] + tests )
89+ retcode = subprocess .call (command , cwd = ROOT_DIR , env = env , shell = True )
14590 if retcode :
14691 # Emit failure tag, and keep going.
14792 print '@@@STEP_FAILURE@@@'
@@ -157,11 +102,7 @@ def GypBuild():
157102 print 'Done.'
158103
159104 retcode = 0
160- # The Android gyp bot runs on linux so this must be tested first.
161- if os .environ ['BUILDBOT_BUILDERNAME' ] == 'gyp-android' :
162- PrepareAndroidTree ()
163- retcode += GypTestFormat ('android' )
164- elif sys .platform .startswith ('linux' ):
105+ if sys .platform .startswith ('linux' ):
165106 retcode += GypTestFormat ('ninja' )
166107 retcode += GypTestFormat ('make' )
167108 PrepareCmake ()
@@ -173,8 +114,13 @@ def GypBuild():
173114 elif sys .platform == 'win32' :
174115 retcode += GypTestFormat ('ninja' )
175116 if os .environ ['BUILDBOT_BUILDERNAME' ] == 'gyp-win64' :
176- retcode += GypTestFormat ('msvs-2010' , format = 'msvs' , msvs_version = '2010' )
177- retcode += GypTestFormat ('msvs-2012' , format = 'msvs' , msvs_version = '2012' )
117+ retcode += GypTestFormat ('msvs-ninja-2013' , format = 'msvs-ninja' ,
118+ msvs_version = '2013' ,
119+ tests = [
120+ r'test\generator-output\gyptest-actions.py' ,
121+ r'test\generator-output\gyptest-relocate.py' ,
122+ r'test\generator-output\gyptest-rules.py' ])
123+ retcode += GypTestFormat ('msvs-2013' , format = 'msvs' , msvs_version = '2013' )
178124 else :
179125 raise Exception ('Unknown platform' )
180126 if retcode :
0 commit comments