From 2512c25c0bb3649c4cc8be20ac30d59630241ae4 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 28 Jan 2022 14:59:33 +0530 Subject: ninja backend: Fix usage of same constants file for native and cross For example: ``` meson builddir \ --native-file vs2019-paths.txt \ --native-file vs2019-win-x64.txt \ --cross-file vs2019-paths.txt \ --cross-file vs2019-win-arm64.txt ``` This was causing the error: > ERROR: Multiple producers for Ninja target "/path/to/vs2019-paths.txt". Please rename your targets. Fix it by using a set() when generating the list of regen files, and add a test for it too. --- unittests/linuxliketests.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'unittests/linuxliketests.py') diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index 90db4ca..f3dc7b3 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -1030,7 +1030,7 @@ class LinuxlikeTests(BasePlatformTests): endian = 'little' ''')) crossfile.flush() - self.meson_cross_file = crossfile.name + self.meson_cross_files = [crossfile.name] self.init(testdir) def test_reconfigure(self): @@ -1501,21 +1501,28 @@ class LinuxlikeTests(BasePlatformTests): def test_identity_cross(self): testdir = os.path.join(self.unit_test_dir, '61 identity cross') + constantsfile = tempfile.NamedTemporaryFile(mode='w') + constantsfile.write(textwrap.dedent('''\ + [constants] + py_ext = '.py' + ''')) + constantsfile.flush() + nativefile = tempfile.NamedTemporaryFile(mode='w') nativefile.write(textwrap.dedent('''\ [binaries] - c = ['{}'] - '''.format(os.path.join(testdir, 'build_wrapper.py')))) + c = ['{}' + py_ext] + '''.format(os.path.join(testdir, 'build_wrapper')))) nativefile.flush() - self.meson_native_file = nativefile.name + self.meson_native_files = [constantsfile.name, nativefile.name] crossfile = tempfile.NamedTemporaryFile(mode='w') crossfile.write(textwrap.dedent('''\ [binaries] - c = ['{}'] - '''.format(os.path.join(testdir, 'host_wrapper.py')))) + c = ['{}' + py_ext] + '''.format(os.path.join(testdir, 'host_wrapper')))) crossfile.flush() - self.meson_cross_file = crossfile.name + self.meson_cross_files = [constantsfile.name, crossfile.name] # TODO should someday be explicit about build platform only here self.init(testdir) @@ -1531,7 +1538,7 @@ class LinuxlikeTests(BasePlatformTests): c = ['{}'] '''.format(os.path.join(testdir, 'host_wrapper.py')))) crossfile.flush() - self.meson_cross_file = crossfile.name + self.meson_cross_files = [crossfile.name] # TODO should someday be explicit about build platform only here self.init(testdir, override_envvars=env) -- cgit v1.1