aboutsummaryrefslogtreecommitdiff
path: root/unittests/allplatformstests.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 /unittests/allplatformstests.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 'unittests/allplatformstests.py')
-rw-r--r--unittests/allplatformstests.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 824d97b..1b8ff85 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -793,6 +793,26 @@ class AllPlatformTests(BasePlatformTests):
self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'subprjfail:fail', '--no-suite', 'subprjmix:fail'])
+ def test_mtest_reconfigure(self):
+ if self.backend is not Backend.ninja:
+ raise SkipTest(f'mtest can\'t rebuild with {self.backend.name!r}')
+
+ testdir = os.path.join(self.common_test_dir, '206 tap tests')
+ self.init(testdir)
+ self.utime(os.path.join(testdir, 'meson.build'))
+ o = self._run(self.mtest_command + ['--list'])
+ self.assertIn('Regenerating build files.', o)
+ self.assertIn('test_features / xfail', o)
+ o = self._run(self.mtest_command + ['--list'])
+ self.assertNotIn('Regenerating build files.', o)
+ # no real targets should have been built
+ tester = os.path.join(self.builddir, 'tester' + exe_suffix)
+ self.assertPathDoesNotExist(tester)
+ # check that we don't reconfigure if --no-rebuild is passed
+ self.utime(os.path.join(testdir, 'meson.build'))
+ o = self._run(self.mtest_command + ['--list', '--no-rebuild'])
+ self.assertNotIn('Regenerating build files.', o)
+
def test_build_by_default(self):
testdir = os.path.join(self.common_test_dir, '129 build by default')
self.init(testdir)