aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py34
1 files changed, 32 insertions, 2 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 8a12180..6cc6302 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -3915,7 +3915,7 @@ recommended as it is not supported on some platforms''')
with tempfile.NamedTemporaryFile(mode='w', delete=False) as crossfile:
crossfile.write(textwrap.dedent(
'''[binaries]
- pkgconfig = r'{0}'
+ pkgconfig = '{0}'
[properties]
@@ -3945,7 +3945,7 @@ recommended as it is not supported on some platforms''')
pkgconfig = 'pkg-config'
[properties]
- pkg_config_libdir = [r'{0}']
+ pkg_config_libdir = ['{0}']
[host_machine]
system = 'linux'
@@ -4969,6 +4969,36 @@ recommended as it is not supported on some platforms''')
self.run_tests()
self.run_target('coverage-xml')
+ def test_cross_file_constants(self):
+ with temp_filename() as crossfile1, temp_filename() as crossfile2:
+ with open(crossfile1, 'w') as f:
+ f.write(textwrap.dedent(
+ '''
+ [constants]
+ compiler = 'gcc'
+ '''))
+ with open(crossfile2, 'w') as f:
+ f.write(textwrap.dedent(
+ '''
+ [constants]
+ toolchain = '/toolchain/'
+ common_flags = ['--sysroot=' + toolchain / 'sysroot']
+
+ [properties]
+ c_args = common_flags + ['-DSOMETHING']
+ cpp_args = c_args + ['-DSOMETHING_ELSE']
+
+ [binaries]
+ c = toolchain / compiler
+ '''))
+
+ values = mesonbuild.coredata.parse_machine_files([crossfile1, crossfile2])
+ self.assertEqual(values['binaries']['c'], '/toolchain/gcc')
+ self.assertEqual(values['properties']['c_args'],
+ ['--sysroot=/toolchain/sysroot', '-DSOMETHING'])
+ self.assertEqual(values['properties']['cpp_args'],
+ ['--sysroot=/toolchain/sysroot', '-DSOMETHING', '-DSOMETHING_ELSE'])
+
class FailureTests(BasePlatformTests):
'''
Tests that test failure conditions. Build files here should be dynamically