Skip to content

Commit 8c97348

Browse files
bonzinieli-schwartz
authored andcommitted
unittests: add test for c_link_args and CFLAGS interaction
Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 2dc4dde)
1 parent 524e547 commit 8c97348

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

unittests/linuxliketests.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,24 @@ def test_installed_soname(self):
446446
libdir = self.installdir + os.path.join(self.prefix, self.libdir)
447447
self._test_soname_impl(libdir, True)
448448

449+
@skip_if_not_base_option('b_sanitize')
450+
def test_c_link_args_and_env(self):
451+
'''
452+
Test that the CFLAGS / CXXFLAGS environment variables are
453+
included on the linker command line when c_link_args is
454+
set but c_args is not.
455+
'''
456+
if is_cygwin():
457+
raise SkipTest('asan not available on Cygwin')
458+
if is_openbsd():
459+
raise SkipTest('-fsanitize=address is not supported on OpenBSD')
460+
461+
testdir = os.path.join(self.common_test_dir, '1 trivial')
462+
env = {'CFLAGS': '-fsanitize=address'}
463+
self.init(testdir, extra_args=['-Dc_link_args="-L/usr/lib"'],
464+
override_envvars=env)
465+
self.build()
466+
449467
def test_compiler_check_flags_order(self):
450468
'''
451469
Test that compiler check flags override all other flags. This can't be

0 commit comments

Comments
 (0)