diff options
author | John Ericson <git@JohnEricson.me> | 2019-08-02 14:29:40 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-03-23 17:51:36 +0200 |
commit | 3a4388e51dee5e7e58f1e5ad4e60fb73b4aacf08 (patch) | |
tree | 8f0637e630777cc4a5707c16a30c4d980b888371 /run_unittests.py | |
parent | f6b0425576640e1613f64503951c7c604b868947 (diff) | |
download | meson-3a4388e51dee5e7e58f1e5ad4e60fb73b4aacf08.zip meson-3a4388e51dee5e7e58f1e5ad4e60fb73b4aacf08.tar.gz meson-3a4388e51dee5e7e58f1e5ad4e60fb73b4aacf08.tar.bz2 |
Fix legacy env var support with cross
Fix #3969
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py index 962ab5d..d1c10f5 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1454,6 +1454,7 @@ class BasePlatformTests(unittest.TestCase): # FIXME: Extract this from argv? self.backend = getattr(Backend, os.environ.get('MESON_UNIT_TEST_BACKEND', 'ninja')) self.meson_args = ['--backend=' + self.backend.name] + self.meson_native_file = None self.meson_cross_file = None self.meson_command = python_command + [get_meson_script()] self.setup_command = self.meson_command + self.meson_args @@ -1563,6 +1564,8 @@ class BasePlatformTests(unittest.TestCase): if default_args: args += ['--prefix', self.prefix, '--libdir', self.libdir] + if self.meson_native_file: + args += ['--native-file', self.meson_native_file] if self.meson_cross_file: args += ['--cross-file', self.meson_cross_file] self.privatedir = os.path.join(self.builddir, 'meson-private') @@ -6313,8 +6316,30 @@ class LinuxlikeTests(BasePlatformTests): def test_identity_cross(self): testdir = os.path.join(self.unit_test_dir, '61 identity cross') + + nativefile = tempfile.NamedTemporaryFile(mode='w') + nativefile.write('''[binaries] +c = ['{0}'] +'''.format(os.path.join(testdir, 'build_wrapper.py'))) + nativefile.flush() + self.meson_native_file = nativefile.name + + crossfile = tempfile.NamedTemporaryFile(mode='w') + crossfile.write('''[binaries] +c = ['{0}'] +'''.format(os.path.join(testdir, 'host_wrapper.py'))) + crossfile.flush() + self.meson_cross_file = crossfile.name + + # TODO should someday be explicit about build platform only here + self.init(testdir) + + def test_identity_cross_env(self): + testdir = os.path.join(self.unit_test_dir, '61 identity cross') + env = { + 'CC_FOR_BUILD': '"' + os.path.join(testdir, 'build_wrapper.py') + '"', + } crossfile = tempfile.NamedTemporaryFile(mode='w') - env = {'CC': '"' + os.path.join(testdir, 'build_wrapper.py') + '"'} crossfile.write('''[binaries] c = ['{0}'] '''.format(os.path.join(testdir, 'host_wrapper.py'))) |