diff options
| author | Sam James <sam@gentoo.org> | 2025-11-23 20:14:42 +0000 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-12-01 16:55:18 +0200 |
| commit | 6419b22f6183d87c92d42bd3a99aa2787cb13e08 (patch) | |
| tree | 4905fdfce792e21752761e065b0cbff6f62eff99 /unittests | |
| parent | b3a0f9ce6147b5b2f6fbfdb257138e1f3a796086 (diff) | |
| download | meson-6419b22f6183d87c92d42bd3a99aa2787cb13e08.tar.gz | |
templates: fix --executable
* In 1.7.1, the behaviour of --executable was to just ignore it.
* After my recent 9104bb616766bd9a05f0b2f280359463d32e227d, the behaviour
was that we'd require, for --executable xyz, xyz.c to exist or we'd
fail to generate.
Neither are good! Instead, create the sample source file w/ the project
name, but call the executable whatever the user passed with `--executable`.
Bug: https://github.com/mesonbuild/meson/issues/15286
Diffstat (limited to 'unittests')
| -rw-r--r-- | unittests/allplatformstests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 2c5123281..554217043 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -2541,6 +2541,20 @@ class AllPlatformTests(BasePlatformTests): self._run(ninja, workdir=os.path.join(tmpdir, 'builddir')) + # custom executable name + if target_type == 'executable': + with tempfile.TemporaryDirectory() as tmpdir: + self._run(self.meson_command + ['init', '--language', lang, '--type', target_type, + '--executable', 'foobar'], workdir=tmpdir) + self._run(self.setup_command + ['--backend=ninja', 'builddir'], + workdir=tmpdir) + self._run(ninja, + workdir=os.path.join(tmpdir, 'builddir')) + + if lang not in {'cs', 'java'}: + exe = os.path.join(tmpdir, 'builddir', 'foobar' + exe_suffix) + self.assertTrue(os.path.exists(exe)) + def _template_test_dirty(lang, target_type): if is_windows() and lang == 'fortran' and target_type == 'library': # non-Gfortran Windows Fortran compilers do not do shared libraries in a Fortran standard way |
