aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mtest.py
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2022-08-23 10:42:22 -0700
committerEli Schwartz <eschwartz93@gmail.com>2022-09-04 19:05:14 -0400
commit628effb3698e85e403351d2705d576cf4ee8c50c (patch)
tree170da5e2fb1f5a2c47f0d883a3ae45c6d77819bf /mesonbuild/mtest.py
parentf501e3b1875fd2c929a8a14771bda3ea4550feed (diff)
downloadmeson-628effb3698e85e403351d2705d576cf4ee8c50c.zip
meson-628effb3698e85e403351d2705d576cf4ee8c50c.tar.gz
meson-628effb3698e85e403351d2705d576cf4ee8c50c.tar.bz2
mtest: Run ninja build.ninja before loading tests
When the build definition has changed since the last ninja invocation meson test operated on an outdated list of tests and their dependencies. That could lead to some tests not being run / not all dependencies being built. This was particularly confusing because the user would see the output of reconfiguration and rebuilding, and the next mtest invocation would have the updated configuration. One issue with this is that that we will now output more useless ninja output when nothing needs to be done (the "Entering directory" part is not repeated, as we happen to be in the build directory already). It likely is worth removing that output, perhaps by testing if anything needs to be done with ninja -n, but that seems better addressed separately. Fixes: #9852
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r--mesonbuild/mtest.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index ba9b065..8b23829 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -1560,6 +1560,16 @@ class TestHarness:
startdir = os.getcwd()
try:
os.chdir(self.options.wd)
+
+ # Before loading build / test data, make sure that the build
+ # configuration does not need to be regenerated. This needs to
+ # happen before rebuild_deps(), because we need the correct list of
+ # tests and their dependencies to compute
+ if not self.options.no_rebuild:
+ ret = subprocess.run(self.ninja + ['build.ninja']).returncode
+ if ret != 0:
+ raise TestException(f'Could not configure {self.options.wd!r}')
+
self.build_data = build.load(os.getcwd())
if not self.options.setup:
self.options.setup = self.build_data.test_setup_default_name