Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: native_client_sdk/src/build_tools/buildbot_run.py

Issue 15979033: [NaCl SDK] Use subst to keep path lengths short on the buildbots. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « native_client_sdk/src/build_tools/build_sdk.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Main entry point for the NaCl SDK buildbot. 6 """Main entry point for the NaCl SDK buildbot.
7 7
8 The entry point used to be build_sdk.py itself, but we want 8 The entry point used to be build_sdk.py itself, but we want
9 to be able to simplify build_sdk (for example separating out 9 to be able to simplify build_sdk (for example separating out
10 the test code into test_sdk) and change its default behaviour 10 the test code into test_sdk) and change its default behaviour
11 while being able to separately control excactly what the bots 11 while being able to separately control excactly what the bots
12 run. 12 run.
13 """ 13 """
14 14
15 import buildbot_common 15 import buildbot_common
16 import os 16 import os
17 import subprocess
17 import sys 18 import sys
19
18 from buildbot_common import Run 20 from buildbot_common import Run
19 from build_paths import SDK_SRC_DIR, SCRIPT_DIR 21 from build_paths import SRC_DIR, SDK_SRC_DIR, SCRIPT_DIR
22 import getos
20 23
21 24
22 def StepRunUnittests(): 25 def StepRunUnittests():
23 buildbot_common.BuildStep('Run unittests') 26 buildbot_common.BuildStep('Run unittests')
24 27
25 # Our tests shouldn't be using the proxy; they should all be connecting to 28 # Our tests shouldn't be using the proxy; they should all be connecting to
26 # localhost. Some slaves can't route HTTP traffic through the proxy to 29 # localhost. Some slaves can't route HTTP traffic through the proxy to
27 # localhost (we get 504 gateway errors), so we clear it here. 30 # localhost (we get 504 gateway errors), so we clear it here.
28 env = dict(os.environ) 31 env = dict(os.environ)
29 if 'http_proxy' in env: 32 if 'http_proxy' in env:
30 del env['http_proxy'] 33 del env['http_proxy']
31 34
32 Run([sys.executable, 'test_all.py'], env=env, cwd=SDK_SRC_DIR) 35 Run([sys.executable, 'test_all.py'], env=env, cwd=SDK_SRC_DIR)
33 36
34 37
35 def StepBuildSDK(args): 38 def StepBuildSDK(args):
36 Run([sys.executable, 'build_sdk.py'] + args, cwd=SCRIPT_DIR) 39 is_win = getos.GetPlatform() == 'win'
40
41 # Windows has a path length limit of 255 characters, after joining cwd with a
42 # relative path. Use subst before building to keep the path lengths short.
43 if is_win:
44 subst_drive = 'S:'
45 root_dir = os.path.dirname(SRC_DIR)
46 new_root_dir = subst_drive + '\\'
47 subprocess.check_call(['subst', subst_drive, root_dir])
48 new_script_dir = os.path.join(new_root_dir,
49 os.path.relpath(SCRIPT_DIR, root_dir))
50 else:
51 new_script_dir = SCRIPT_DIR
52
53 try:
54 Run([sys.executable, 'build_sdk.py'] + args, cwd=new_script_dir)
55 finally:
56 if is_win:
57 subprocess.check_call(['subst', '/D', subst_drive])
37 58
38 59
39 def StepTestSDK(): 60 def StepTestSDK():
40 Run([sys.executable, 'test_sdk.py'], cwd=SCRIPT_DIR) 61 Run([sys.executable, 'test_sdk.py'], cwd=SCRIPT_DIR)
41 62
42 63
43 def main(args): 64 def main(args):
44 StepRunUnittests() 65 StepRunUnittests()
45 StepBuildSDK(args) 66 StepBuildSDK(args)
46 StepTestSDK() 67 StepTestSDK()
47 return 0 68 return 0
48 69
49 70
50 if __name__ == '__main__': 71 if __name__ == '__main__':
51 try: 72 try:
52 sys.exit(main(sys.argv[1:])) 73 sys.exit(main(sys.argv[1:]))
53 except KeyboardInterrupt: 74 except KeyboardInterrupt:
54 buildbot_common.ErrorExit('buildbot_run: interrupted') 75 buildbot_common.ErrorExit('buildbot_run: interrupted')
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/build_sdk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698