Skip to content

Commit

Permalink
mtest: Fix mtest for new test targets
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Mar 19, 2020
1 parent 8d34fe6 commit ef87c6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mesonbuild/minstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def run(opts):
if not os.path.exists(os.path.join(opts.wd, datafilename)):
sys.exit('Install data not found. Run this command in build directory root.')
if not opts.no_rebuild:
if not rebuild_all(opts.wd):
if not rebuild_all(opts.wd, 'all'):
sys.exit(-1)
os.chdir(opts.wd)
with open(os.path.join(log_dir, 'install-log.txt'), 'w') as lf:
Expand Down
6 changes: 3 additions & 3 deletions mesonbuild/mtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ def list_tests(th: TestHarness) -> bool:
print(th.get_pretty_suite(t))
return not tests

def rebuild_all(wd: str) -> bool:
def rebuild_all(wd: str, target: str) -> bool:
if not (Path(wd) / 'build.ninja').is_file():
print('Only ninja backend is supported to rebuild tests before running them.')
return True
Expand All @@ -995,7 +995,7 @@ def rebuild_all(wd: str) -> bool:
print("Can't find ninja, can't rebuild test.")
return False

ret = subprocess.run([ninja, '-C', wd]).returncode
ret = subprocess.run([ninja, '-C', wd, target]).returncode
if ret != 0:
print('Could not rebuild {}'.format(wd))
return False
Expand Down Expand Up @@ -1029,7 +1029,7 @@ def run(options: argparse.Namespace) -> int:
options.wd = os.path.abspath(options.wd)

if not options.list and not options.no_rebuild:
if not rebuild_all(options.wd):
if not rebuild_all(options.wd, 'meson-build-benchmarks' if options.benchmark else 'meson-build-tests'):
# We return 125 here in case the build failed.
# The reason is that exit code 125 tells `git bisect run` that the current commit should be skipped.
# Thus users can directly use `meson test` to bisect without needing to handle the does-not-build case separately in a wrapper script.
Expand Down

0 comments on commit ef87c6a

Please sign in to comment.