aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorOle André Vadla RavnÄs <oleavr@gmail.com>2017-05-22 00:53:41 +0200
committerOle André Vadla RavnÄs <oleavr@gmail.com>2017-05-29 21:05:57 +0200
commitb32c757073c3227a05d770ec56d953f5aac663d0 (patch)
tree8e0fcabd9a4e69d02cf486842ee7b9d8314f63b5 /run_unittests.py
parent0f85d9f66d85a6cca7e57dba6a9590a3bdbac57d (diff)
downloadmeson-b32c757073c3227a05d770ec56d953f5aac663d0.zip
meson-b32c757073c3227a05d770ec56d953f5aac663d0.tar.gz
meson-b32c757073c3227a05d770ec56d953f5aac663d0.tar.bz2
environment: Add needs_exe_wrapper for overriding auto-detection.
This is useful when build_machine appears to be compatible with host_machine, but actually isn't. For example when: - build_machine is macOS and host_machine is the iOS Simulator - the build_machine's libc is glibc but the host_machine libc is uClibc - code relies on kernel features not available on the build_machine
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index e3b7c5c..b85ad8a 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -22,6 +22,7 @@ import os
import shutil
import sys
import unittest
+from configparser import ConfigParser
from glob import glob
from pathlib import PurePath
import mesonbuild.compilers
@@ -323,6 +324,35 @@ class InternalTests(unittest.TestCase):
cmd = ['@OUTPUT@.out', 'ordinary', 'strings']
self.assertRaises(ME, substfunc, cmd, d)
+ def test_needs_exe_wrapper_override(self):
+ config = ConfigParser()
+ config['binaries'] = {
+ 'c': '\'/usr/bin/gcc\'',
+ }
+ config['host_machine'] = {
+ 'system': '\'linux\'',
+ 'cpu_family': '\'arm\'',
+ 'cpu': '\'armv7\'',
+ 'endian': '\'little\'',
+ }
+
+ with tempfile.NamedTemporaryFile(mode='w+') as configfile:
+ config.write(configfile)
+ configfile.flush()
+ detected_value = mesonbuild.environment.CrossBuildInfo(configfile.name).need_exe_wrapper()
+
+ desired_value = not detected_value
+ config['properties'] = {
+ 'needs_exe_wrapper': 'true' if desired_value else 'false'
+ }
+
+ with tempfile.NamedTemporaryFile(mode='w+') as configfile:
+ config.write(configfile)
+ configfile.flush()
+ forced_value = mesonbuild.environment.CrossBuildInfo(configfile.name).need_exe_wrapper()
+
+ self.assertEqual(forced_value, desired_value)
+
class BasePlatformTests(unittest.TestCase):
def setUp(self):