From 2fabd4c7dc22373e99fc63823d80083ad30704b8 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 15 Feb 2021 16:00:12 -0500 Subject: minstall: Add --skip-subprojects option By default all subprojects are installed. If --skip-subprojects is given with no value only the main project is installed. If --skip-subprojects is given with a value, it should be a coma separated list of subprojects to skip and all others will be installed. Fixes: #2550. --- run_unittests.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'run_unittests.py') diff --git a/run_unittests.py b/run_unittests.py index 62bf65c59..a82e476dc 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -65,6 +65,7 @@ from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram import mesonbuild.dependencies.base from mesonbuild.build import Target, ConfigurationData import mesonbuild.modules.pkgconfig +from mesonbuild.scripts import destdir_join from mesonbuild.mtest import TAPParser, TestResult @@ -5496,6 +5497,52 @@ class AllPlatformTests(BasePlatformTests): srcdir = os.path.join(self.common_test_dir, '2 cpp') self.init(srcdir, extra_args=['-Dbuild.b_lto=true']) + def test_install_skip_subprojects(self): + testdir = os.path.join(self.unit_test_dir, '91 install skip subprojects') + self.init(testdir) + self.build() + + main_expected = [ + '', + 'share', + 'include', + 'foo', + 'bin', + 'share/foo', + 'share/foo/foo.dat', + 'include/foo.h', + 'foo/foofile', + 'bin/foo' + exe_suffix, + ] + bar_expected = [ + 'bar', + 'share/foo/bar.dat', + 'include/bar.h', + 'bin/bar' + exe_suffix, + 'bar/barfile' + ] + env = get_fake_env(testdir, self.builddir, self.prefix) + cc = env.detect_c_compiler(MachineChoice.HOST) + if cc.get_argument_syntax() == 'msvc': + main_expected.append('bin/foo.pdb') + bar_expected.append('bin/bar.pdb') + prefix = destdir_join(self.installdir, self.prefix) + main_expected = [Path(prefix, p) for p in main_expected] + bar_expected = [Path(prefix, p) for p in bar_expected] + all_expected = main_expected + bar_expected + + def check_installed_files(extra_args, expected): + args = ['install', '--destdir', self.installdir] + extra_args + self._run(self.meson_command + args, workdir=self.builddir) + all_files = [p for p in Path(self.installdir).rglob('*')] + self.assertEqual(sorted(expected), sorted(all_files)) + windows_proof_rmtree(self.installdir) + + check_installed_files([], all_expected) + check_installed_files(['--skip-subprojects'], main_expected) + check_installed_files(['--skip-subprojects', 'bar'], main_expected) + check_installed_files(['--skip-subprojects', 'another'], all_expected) + class FailureTests(BasePlatformTests): ''' -- cgit v1.3