summaryrefslogtreecommitdiff
path: root/unittests/machinefiletests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2022-02-09 02:11:30 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2022-02-09 02:11:30 +0200
commitf11c643a82a911f8e9419557dae5d80af9aa3f92 (patch)
treeba6f22ae2342d3888fa1168759c5078f8c916ac2 /unittests/machinefiletests.py
parentd082204096afd51730f44a75bd02423f74c2e5ae (diff)
downloadmeson-crossenvvar.tar.gz
Properly error out when cross file is missing a compiler.crossenvvar
Diffstat (limited to 'unittests/machinefiletests.py')
-rw-r--r--unittests/machinefiletests.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/unittests/machinefiletests.py b/unittests/machinefiletests.py
index 0a756b572..a124b64a7 100644
--- a/unittests/machinefiletests.py
+++ b/unittests/machinefiletests.py
@@ -740,7 +740,7 @@ class CrossFileTests(BasePlatformTests):
self.init(testdir, extra_args=['--cross-file=' + name], inprocess=True)
self.wipe()
- def helper_create_cross_file(self, values):
+ def helper_create_cross_file(self, values, *, add_fake_compilers=True):
"""Create a config file as a temporary file.
values should be a nested dictionary structure of {section: {key:
@@ -748,6 +748,13 @@ class CrossFileTests(BasePlatformTests):
"""
filename = os.path.join(self.builddir, f'generated{self.current_config}.config')
self.current_config += 1
+ if add_fake_compilers:
+ if is_windows() and shutil.which('cl'):
+ base = {'binaries': {'c': 'cl', 'cpp': 'cl'}}
+ else:
+ base = {'binaries': {'c': 'cc', 'cpp': 'c++'}}
+ base.update(values)
+ values = base
with open(filename, 'wt', encoding='utf-8') as f:
for section, entries in values.items():
f.write(f'[{section}]\n')