diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-02-15 16:00:12 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-02-22 23:03:55 +0200 |
commit | 2fabd4c7dc22373e99fc63823d80083ad30704b8 (patch) | |
tree | e2c9bf7d46812ee4e62e0289ea8cf3b6dc1801f6 /run_unittests.py | |
parent | 36d9d7a96f6f42386b9dc3a18c152ccd4c8ca37b (diff) | |
download | meson-2fabd4c7dc22373e99fc63823d80083ad30704b8.zip meson-2fabd4c7dc22373e99fc63823d80083ad30704b8.tar.gz meson-2fabd4c7dc22373e99fc63823d80083ad30704b8.tar.bz2 |
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.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 62bf65c..a82e476 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): ''' |