diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-10-09 16:11:02 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-11-15 18:42:25 -0800 |
commit | f2d503ca3416fc44eae5bed98ef0ab62773153c5 (patch) | |
tree | 2ac5cf74b008414be101596f74b5286c89f8819f /run_unittests.py | |
parent | 484fca9866f6b477a2ca30bb75be8a15de598e66 (diff) | |
download | meson-f2d503ca3416fc44eae5bed98ef0ab62773153c5.zip meson-f2d503ca3416fc44eae5bed98ef0ab62773153c5.tar.gz meson-f2d503ca3416fc44eae5bed98ef0ab62773153c5.tar.bz2 |
unittests: don't run sanitizer tests for on compilers without sanitizer support
This commit adds a nice decorator helper for skipping tests when they
require the compiler to implement a specific base option, and uses it to
turn off b_sanitize tests, which fixes some tests on ICC.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index bc11732..cdb04c0 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') @@ -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') |