From 79e2c52a15e896e46ff3cfa3ec16fbf3f132ee01 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 26 Oct 2020 08:41:45 -0400 Subject: mtest: only build what is needed for the tests It is a usual workflow to fix something and retest to see if it is fixed using a particular test. When tests start to become numerous, it becomes time consuming for "meson test" to relink all of them (and in fact rebuild the whole project) where the user has already specified the tests they want to run, as well as the tests' dependencies. Teach meson to be smart and only build what is needed for the test (or suite) that were specified. Fixes: #7473 Related: #7830 --- mesonbuild/minstall.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'mesonbuild/minstall.py') diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py index 47bb88b..a8ec8f3 100644 --- a/mesonbuild/minstall.py +++ b/mesonbuild/minstall.py @@ -19,7 +19,6 @@ from glob import glob from .scripts import depfixer from .scripts import destdir_join from .mesonlib import is_windows, Popen_safe -from .mtest import rebuild_all from .backend.backends import InstallData from .coredata import major_versions_differ, MesonVersionMismatchException from .coredata import version as coredata_version @@ -532,6 +531,23 @@ class Installer: else: raise +def rebuild_all(wd: str) -> bool: + if not (Path(wd) / 'build.ninja').is_file(): + print('Only ninja backend is supported to rebuild the project before installation.') + return True + + ninja = environment.detect_ninja() + if not ninja: + print("Can't find ninja, can't rebuild test.") + return False + + ret = subprocess.run(ninja + ['-C', wd]).returncode + if ret != 0: + print('Could not rebuild {}'.format(wd)) + return False + + return True + def run(opts): datafilename = 'meson-private/install.dat' private_dir = os.path.dirname(datafilename) -- cgit v1.1