aboutsummaryrefslogtreecommitdiff
path: root/unittests/linuxliketests.py
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/linuxliketests.py')
-rw-r--r--unittests/linuxliketests.py36
1 files changed, 27 insertions, 9 deletions
diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py
index 376c395..073f03c 100644
--- a/unittests/linuxliketests.py
+++ b/unittests/linuxliketests.py
@@ -446,6 +446,24 @@ class LinuxlikeTests(BasePlatformTests):
libdir = self.installdir + os.path.join(self.prefix, self.libdir)
self._test_soname_impl(libdir, True)
+ @skip_if_not_base_option('b_sanitize')
+ def test_c_link_args_and_env(self):
+ '''
+ Test that the CFLAGS / CXXFLAGS environment variables are
+ included on the linker command line when c_link_args is
+ set but c_args is not.
+ '''
+ if is_cygwin():
+ raise SkipTest('asan not available on Cygwin')
+ if is_openbsd():
+ raise SkipTest('-fsanitize=address is not supported on OpenBSD')
+
+ testdir = os.path.join(self.common_test_dir, '1 trivial')
+ env = {'CFLAGS': '-fsanitize=address'}
+ self.init(testdir, extra_args=['-Dc_link_args="-L/usr/lib"'],
+ override_envvars=env)
+ self.build()
+
def test_compiler_check_flags_order(self):
'''
Test that compiler check flags override all other flags. This can't be
@@ -1379,7 +1397,7 @@ class LinuxlikeTests(BasePlatformTests):
see: https://github.com/mesonbuild/meson/issues/9000
https://stackoverflow.com/questions/48532868/gcc-library-option-with-a-colon-llibevent-a
'''
- testdir = os.path.join(self.unit_test_dir, '97 link full name','libtestprovider')
+ testdir = os.path.join(self.unit_test_dir, '98 link full name','libtestprovider')
oldprefix = self.prefix
# install into installdir without using DESTDIR
installdir = self.installdir
@@ -1392,7 +1410,7 @@ class LinuxlikeTests(BasePlatformTests):
self.new_builddir()
env = {'LIBRARY_PATH': os.path.join(installdir, self.libdir),
'PKG_CONFIG_PATH': _prepend_pkg_config_path(os.path.join(installdir, self.libdir, 'pkgconfig'))}
- testdir = os.path.join(self.unit_test_dir, '97 link full name','proguser')
+ testdir = os.path.join(self.unit_test_dir, '98 link full name','proguser')
self.init(testdir,override_envvars=env)
# test for link with full path
@@ -1798,7 +1816,7 @@ class LinuxlikeTests(BasePlatformTests):
@skipUnless(is_linux() or is_osx(), 'Test only applicable to Linux and macOS')
def test_install_strip(self):
- testdir = os.path.join(self.unit_test_dir, '103 strip')
+ testdir = os.path.join(self.unit_test_dir, '104 strip')
self.init(testdir)
self.build()
@@ -1845,7 +1863,7 @@ class LinuxlikeTests(BasePlatformTests):
self.assertFalse(cpp.compiler_args([f'-isystem{symlink}' for symlink in default_symlinks]).to_native())
def test_freezing(self):
- testdir = os.path.join(self.unit_test_dir, '110 freeze')
+ testdir = os.path.join(self.unit_test_dir, '111 freeze')
self.init(testdir)
self.build()
with self.assertRaises(subprocess.CalledProcessError) as e:
@@ -1854,7 +1872,7 @@ class LinuxlikeTests(BasePlatformTests):
@skipUnless(is_linux(), "Ninja file differs on different platforms")
def test_complex_link_cases(self):
- testdir = os.path.join(self.unit_test_dir, '114 complex link cases')
+ testdir = os.path.join(self.unit_test_dir, '115 complex link cases')
self.init(testdir)
self.build()
with open(os.path.join(self.builddir, 'build.ninja'), encoding='utf-8') as f:
@@ -1875,11 +1893,11 @@ class LinuxlikeTests(BasePlatformTests):
self.assertIn('build t13-e1: c_LINKER t13-e1.p/main.c.o | libt12-s1.a libt13-s3.a\n', content)
def test_top_options_in_sp(self):
- testdir = os.path.join(self.unit_test_dir, '125 pkgsubproj')
+ testdir = os.path.join(self.unit_test_dir, '127 pkgsubproj')
self.init(testdir)
def test_unreadable_dir_in_declare_dep(self):
- testdir = os.path.join(self.unit_test_dir, '125 declare_dep var')
+ testdir = os.path.join(self.unit_test_dir, '126 declare_dep var')
tmpdir = Path(tempfile.mkdtemp())
self.addCleanup(windows_proof_rmtree, tmpdir)
declaredepdir = tmpdir / 'test'
@@ -1901,7 +1919,7 @@ class LinuxlikeTests(BasePlatformTests):
if self.backend is not Backend.ninja:
raise SkipTest(f'{self.backend.name!r} backend can\'t install files')
- testdir = os.path.join(self.unit_test_dir, '122 persp options')
+ testdir = os.path.join(self.unit_test_dir, '123 persp options')
with self.subTest('init'):
self.init(testdir, extra_args='-Doptimization=1')
@@ -1954,7 +1972,7 @@ class LinuxlikeTests(BasePlatformTests):
self.check_has_flag(compdb, sub2src, '-O2')
def test_sanitizers(self):
- testdir = os.path.join(self.unit_test_dir, '127 sanitizers')
+ testdir = os.path.join(self.unit_test_dir, '129 sanitizers')
with self.subTest('no b_sanitize value'):
try: