Skip to content

Commit 7b24b13

Browse files
mi-acCommit Bot
authored andcommitted
[test] Use the correct precedence for choosing the build directory
This breaks looking for build output after finding valid output. Otherwise build output with lower precedence can overwrite output with higher precedence. This also moves a static method. Bug: chromium:1132088 Change-Id: I1824028243f964ab0956e54ca24921e6f32f2ca3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2440337 Commit-Queue: Michael Achenbach <[email protected]> Commit-Queue: Liviu Rau <[email protected]> Auto-Submit: Michael Achenbach <[email protected]> Reviewed-by: Liviu Rau <[email protected]> Cr-Commit-Position: refs/heads/master@{#70223}
1 parent 60de9d5 commit 7b24b13

1 file changed

Lines changed: 24 additions & 22 deletions

File tree

tools/testrunner/base_runner.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,24 @@ def __str__(self):
245245
return '\n'.join(detected_options)
246246

247247

248+
def _do_load_build_config(outdir, verbose=False):
249+
build_config_path = os.path.join(outdir, "v8_build_config.json")
250+
if not os.path.exists(build_config_path):
251+
if verbose:
252+
print("Didn't find build config: %s" % build_config_path)
253+
raise TestRunnerError()
254+
255+
with open(build_config_path) as f:
256+
try:
257+
build_config_json = json.load(f)
258+
except Exception: # pragma: no cover
259+
print("%s exists but contains invalid json. Is your build up-to-date?"
260+
% build_config_path)
261+
raise TestRunnerError()
262+
263+
return BuildConfig(build_config_json)
264+
265+
248266
class BaseTestRunner(object):
249267
def __init__(self, basedir=None):
250268
self.basedir = basedir or BASE_DIR
@@ -419,7 +437,12 @@ def _parse_args(self, parser, sys_args):
419437
def _load_build_config(self, options):
420438
for outdir in self._possible_outdirs(options):
421439
try:
422-
self.build_config = self._do_load_build_config(outdir, options.verbose)
440+
self.build_config = _do_load_build_config(outdir, options.verbose)
441+
442+
# In auto-detect mode the outdir is always where we found the build config.
443+
# This ensures that we'll also take the build products from there.
444+
self.outdir = outdir
445+
break
423446
except TestRunnerError:
424447
pass
425448

@@ -477,27 +500,6 @@ def _get_gn_outdir(self):
477500
print(">>> Latest GN build found: %s" % latest_config)
478501
return os.path.join(DEFAULT_OUT_GN, latest_config)
479502

480-
def _do_load_build_config(self, outdir, verbose=False):
481-
build_config_path = os.path.join(outdir, "v8_build_config.json")
482-
if not os.path.exists(build_config_path):
483-
if verbose:
484-
print("Didn't find build config: %s" % build_config_path)
485-
raise TestRunnerError()
486-
487-
with open(build_config_path) as f:
488-
try:
489-
build_config_json = json.load(f)
490-
except Exception: # pragma: no cover
491-
print("%s exists but contains invalid json. Is your build up-to-date?"
492-
% build_config_path)
493-
raise TestRunnerError()
494-
495-
# In auto-detect mode the outdir is always where we found the build config.
496-
# This ensures that we'll also take the build products from there.
497-
self.outdir = os.path.dirname(build_config_path)
498-
499-
return BuildConfig(build_config_json)
500-
501503
def _process_default_options(self, options):
502504
# We don't use the mode for more path-magic.
503505
# Therefore transform the bot mode here to fix build_config value.

0 commit comments

Comments
 (0)