3
3
# Use of this source code is governed by a BSD-style license that can be
4
4
# found in the LICENSE file.
5
5
6
-
7
6
"""Argument-less script to select what to run on the buildbots."""
8
7
9
-
10
8
import os
11
9
import shutil
12
10
import subprocess
13
11
import sys
14
12
15
13
16
- if sys .platform in ['win32' , 'cygwin' ]:
17
- EXE_SUFFIX = '.exe'
18
- else :
19
- EXE_SUFFIX = ''
20
-
21
-
22
14
BUILDBOT_DIR = os .path .dirname (os .path .abspath (__file__ ))
23
15
TRUNK_DIR = os .path .dirname (BUILDBOT_DIR )
24
16
ROOT_DIR = os .path .dirname (TRUNK_DIR )
25
- ANDROID_DIR = os .path .join (ROOT_DIR , 'android' )
26
17
CMAKE_DIR = os .path .join (ROOT_DIR , 'cmake' )
27
18
CMAKE_BIN_DIR = os .path .join (CMAKE_DIR , 'bin' )
28
19
OUT_DIR = os .path .join (TRUNK_DIR , 'out' )
29
20
30
21
31
22
def CallSubProcess (* args , ** kwargs ):
32
23
"""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 )
34
26
if retcode != 0 :
35
27
print '@@@STEP_EXCEPTION@@@'
36
28
sys .exit (1 )
@@ -49,10 +41,6 @@ def PrepareCmake():
49
41
50
42
print '@@@BUILD_STEP Initialize CMake checkout@@@'
51
43
os .mkdir (CMAKE_DIR )
52
- CallSubProcess (['git' , 'config' , '--global' , 'user.name' , 'trybot' ])
53
- CallSubProcess (['git' , 'config' , '--global' ,
54
- 'user.email' , 'chrome-bot@google.com' ])
55
- CallSubProcess (['git' , 'config' , '--global' , 'color.ui' , 'false' ])
56
44
57
45
print '@@@BUILD_STEP Sync CMake@@@'
58
46
CallSubProcess (
@@ -73,41 +61,7 @@ def PrepareCmake():
73
61
CallSubProcess ( ['make' , 'cmake' ], cwd = CMAKE_DIR )
74
62
75
63
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' , 'chrome-bot@google.com' ])
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 = []):
111
65
"""Run the gyp tests for a given format, emitting annotator tags.
112
66
113
67
See annotator docs at:
@@ -126,22 +80,13 @@ def GypTestFormat(title, format=None, msvs_version=None):
126
80
if msvs_version :
127
81
env ['GYP_MSVS_VERSION' ] = msvs_version
128
82
command = ' ' .join (
129
- [sys .executable , 'trunk /gyptest.py' ,
83
+ [sys .executable , 'gyp /gyptest.py' ,
130
84
'--all' ,
131
85
'--passed' ,
132
86
'--format' , format ,
133
87
'--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 )
145
90
if retcode :
146
91
# Emit failure tag, and keep going.
147
92
print '@@@STEP_FAILURE@@@'
@@ -157,11 +102,7 @@ def GypBuild():
157
102
print 'Done.'
158
103
159
104
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' ):
165
106
retcode += GypTestFormat ('ninja' )
166
107
retcode += GypTestFormat ('make' )
167
108
PrepareCmake ()
@@ -173,8 +114,13 @@ def GypBuild():
173
114
elif sys .platform == 'win32' :
174
115
retcode += GypTestFormat ('ninja' )
175
116
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' )
178
124
else :
179
125
raise Exception ('Unknown platform' )
180
126
if retcode :
0 commit comments