mtest: move the detection of rebuild compatibility out into the entry point

What we are mainly doing here is checking that the options make sense,
or fixing that up if they don't. And in the next commit we will want to
do that by also checking the build object.
pull/10779/head
Eli Schwartz 2 years ago
parent b4c347674b
commit fccada6703
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 12
      mesonbuild/mtest.py

@ -1582,12 +1582,6 @@ class TestHarness:
if self.options.no_rebuild: if self.options.no_rebuild:
return return
if not (Path(self.options.wd) / 'build.ninja').is_file():
print('Only ninja backend is supported to rebuild tests before running them.')
# Disable, no point in trying to build anything later
self.options.no_rebuild = True
return
self.ninja = environment.detect_ninja() self.ninja = environment.detect_ninja()
if not self.ninja: if not self.ninja:
print("Can't find ninja, can't rebuild test.") print("Can't find ninja, can't rebuild test.")
@ -2104,6 +2098,12 @@ def run(options: argparse.Namespace) -> int:
b = build.load(options.wd) b = build.load(options.wd)
setup_vsenv(b.need_vsenv) setup_vsenv(b.need_vsenv)
if not options.no_rebuild:
if not (Path(options.wd) / 'build.ninja').is_file():
print('Only ninja backend is supported to rebuild tests before running them.')
# Disable, no point in trying to build anything later
options.no_rebuild = True
with TestHarness(options) as th: with TestHarness(options) as th:
try: try:
if options.list: if options.list:

Loading…
Cancel
Save