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

Side by Side Diff: build/android/pylib/constants/__init__.py

Issue 1799073004: 🚄 test_runner.py: Auto-detect output dir when running on bots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | 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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Defines a set of constants shared by test runners and other scripts.""" 5 """Defines a set of constants shared by test runners and other scripts."""
6 6
7 # TODO(jbudorick): Split these constants into coherent modules. 7 # TODO(jbudorick): Split these constants into coherent modules.
8 8
9 # pylint: disable=W0212 9 # pylint: disable=W0212
10 10
11 import collections 11 import collections
12 import glob
12 import logging 13 import logging
13 import os 14 import os
14 import subprocess 15 import subprocess
15 16
16 import devil.android.sdk.keyevent 17 import devil.android.sdk.keyevent
17 from devil.android.sdk import version_codes 18 from devil.android.sdk import version_codes
18 from devil.constants import exit_codes 19 from devil.constants import exit_codes
19 20
20 21
21 keyevent = devil.android.sdk.keyevent 22 keyevent = devil.android.sdk.keyevent
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 Raises: 254 Raises:
254 Exception: If no output directory is detected. 255 Exception: If no output directory is detected.
255 """ 256 """
256 output_dir = os.environ.get('CHROMIUM_OUTPUT_DIR') 257 output_dir = os.environ.get('CHROMIUM_OUTPUT_DIR')
257 out_dir = os.environ.get('CHROMIUM_OUT_DIR') 258 out_dir = os.environ.get('CHROMIUM_OUT_DIR')
258 if not output_dir and not out_dir: 259 if not output_dir and not out_dir:
259 # If CWD is an output directory, then assume it's the desired one. 260 # If CWD is an output directory, then assume it's the desired one.
260 if os.path.exists('build.ninja'): 261 if os.path.exists('build.ninja'):
261 output_dir = os.getcwd() 262 output_dir = os.getcwd()
262 SetOutputDirectory(output_dir) 263 SetOutputDirectory(output_dir)
264 elif os.environ.get('CHROME_HEADLESS'):
265 # When running on bots, see if the output directory is obvious.
266 dirs = glob.glob(os.path.join(DIR_SOURCE_ROOT, 'out', '*', 'build.ninja'))
jbudorick 2016/03/14 17:41:35 I don't think this will work with gyp bots, which
267 if len(dirs) == 1:
268 SetOutputDirectory(dirs[0])
269 else:
270 raise Exception('Neither CHROMIUM_OUTPUT_DIR nor CHROMIUM_OUT_DIR '
271 'has been set. CHROME_HEADLESS detected, but multiple '
272 'out dirs exist: %r' % dirs)
263 else: 273 else:
264 raise Exception('Neither CHROMIUM_OUTPUT_DIR nor CHROMIUM_OUT_DIR ' 274 raise Exception('Neither CHROMIUM_OUTPUT_DIR nor CHROMIUM_OUT_DIR '
265 'has been set') 275 'has been set')
266 276
267 277
268 # TODO(jbudorick): Convert existing callers to AdbWrapper.GetAdbPath() and 278 # TODO(jbudorick): Convert existing callers to AdbWrapper.GetAdbPath() and
269 # remove this. 279 # remove this.
270 def GetAdbPath(): 280 def GetAdbPath():
271 from devil.android.sdk import adb_wrapper 281 from devil.android.sdk import adb_wrapper
272 return adb_wrapper.AdbWrapper.GetAdbPath() 282 return adb_wrapper.AdbWrapper.GetAdbPath()
273 283
274 284
275 # Exit codes 285 # Exit codes
276 ERROR_EXIT_CODE = exit_codes.ERROR 286 ERROR_EXIT_CODE = exit_codes.ERROR
277 INFRA_EXIT_CODE = exit_codes.INFRA 287 INFRA_EXIT_CODE = exit_codes.INFRA
278 WARNING_EXIT_CODE = exit_codes.WARNING 288 WARNING_EXIT_CODE = exit_codes.WARNING
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698