aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/run_unittests.py b/run_unittests.py
index bc11732..e149ded 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -144,6 +144,24 @@ def skip_if_env_value(value):
return wrapped
return wrapper
+def skip_if_not_base_option(feature):
+ """Skip tests if The compiler does not support a given base option.
+
+ for example, ICC doesn't currently support b_sanitize.
+ """
+ def actual(f):
+ @functools.wraps(f)
+ def wrapped(*args, **kwargs):
+ env = get_fake_env('', '', '')
+ cc = env.detect_c_compiler(False)
+ if feature not in cc.base_options:
+ raise unittest.SkipTest(
+ '{} not available with {}'.format(feature, cc.id))
+ return f(*args, **kwargs)
+ return wrapped
+ return actual
+
+
class PatchModule:
'''
Fancy monkey-patching! Whee! Can't use mock.patch because it only
@@ -3522,6 +3540,7 @@ class LinuxlikeTests(BasePlatformTests):
self.assertRegex('\n'.join(mesonlog),
r'Dependency qt5 \(modules: Core\) found: YES 5.* \(pkg-config\)\n')
+ @skip_if_not_base_option('b_sanitize')
def test_generate_gir_with_address_sanitizer(self):
if is_cygwin():
raise unittest.SkipTest('asan not available on Cygwin')
@@ -3899,7 +3918,7 @@ class LinuxlikeTests(BasePlatformTests):
# when all tests are run (but works when only this test is run),
# but doing this explicitly works.
env = os.environ.copy()
- env['LD_LIBRARY_PATH'] = installed_libdir
+ env['LD_LIBRARY_PATH'] = ':'.join([installed_libdir, env.get('LD_LIBRARY_PATH', '')])
self.assertEqual(subprocess.call(installed_exe, env=env), 0)
# Ensure that introspect --installed works
installed = self.introspect('--installed')
@@ -3984,6 +4003,7 @@ class LinuxlikeTests(BasePlatformTests):
install_rpath = get_rpath(os.path.join(self.installdir, 'usr/bin/progcxx'))
self.assertEqual(install_rpath, 'baz')
+ @skip_if_not_base_option('b_sanitize')
def test_pch_with_address_sanitizer(self):
if is_cygwin():
raise unittest.SkipTest('asan not available on Cygwin')
@@ -4099,7 +4119,7 @@ endian = 'little'
self.init(testdir2)
self.build()
myenv = os.environ.copy()
- myenv['LD_LIBRARY_PATH'] = lib_dir
+ myenv['LD_LIBRARY_PATH'] = ':'.join([lib_dir, myenv.get('LD_LIBRARY_PATH', '')])
if is_cygwin():
bin_dir = os.path.join(tempdirname, 'bin')
myenv['PATH'] = bin_dir + os.pathsep + myenv['PATH']