diff options
author | Ned Deily <nad@acm.org> | 2013-05-28 23:45:06 (GMT) |
---|---|---|
committer | Ned Deily <nad@acm.org> | 2013-05-28 23:45:06 (GMT) |
commit | 6750282007f3444fe7b500ae9cf6172921ffd5f4 (patch) | |
tree | 8a1669f11395b830d445eb4ffaf859813dd8660b /Lib/distutils/tests | |
parent | 56dfc2127f6b835d056d025a978f1be2bbb5d431 (diff) | |
parent | 97345680dcf920d6def6217213499be362ed1921 (diff) | |
download | cpython-6750282007f3444fe7b500ae9cf6172921ffd5f4.zip cpython-6750282007f3444fe7b500ae9cf6172921ffd5f4.tar.gz cpython-6750282007f3444fe7b500ae9cf6172921ffd5f4.tar.bz2 |
Issue #18080: merge from 3.3
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r-- | Lib/distutils/tests/test_unixccompiler.py | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/Lib/distutils/tests/test_unixccompiler.py b/Lib/distutils/tests/test_unixccompiler.py index 1bff38e..a5a63fd 100644 --- a/Lib/distutils/tests/test_unixccompiler.py +++ b/Lib/distutils/tests/test_unixccompiler.py @@ -1,7 +1,8 @@ """Tests for distutils.unixccompiler.""" +import os import sys import unittest -from test.support import run_unittest +from test.support import EnvironmentVarGuard, run_unittest from distutils import sysconfig from distutils.unixccompiler import UnixCCompiler @@ -94,7 +95,6 @@ class UnixCCompilerTestCase(unittest.TestCase): sysconfig.get_config_var = gcv self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo') - # non-GCC GNULD sys.platform = 'bar' def gcv(v): @@ -115,6 +115,38 @@ class UnixCCompilerTestCase(unittest.TestCase): sysconfig.get_config_var = gcv self.assertEqual(self.cc.rpath_foo(), '-R/foo') + @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X') + def test_osx_cc_overrides_ldshared(self): + # Issue #18080: + # ensure that setting CC env variable also changes default linker + def gcv(v): + if v == 'LDSHARED': + return 'gcc-4.2 -bundle -undefined dynamic_lookup ' + return 'gcc-4.2' + sysconfig.get_config_var = gcv + with EnvironmentVarGuard() as env: + env['CC'] = 'my_cc' + del env['LDSHARED'] + sysconfig.customize_compiler(self.cc) + self.assertEqual(self.cc.linker_so[0], 'my_cc') + + @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X') + def test_osx_explict_ldshared(self): + # Issue #18080: + # ensure that setting CC env variable does not change + # explicit LDSHARED setting for linker + def gcv(v): + if v == 'LDSHARED': + return 'gcc-4.2 -bundle -undefined dynamic_lookup ' + return 'gcc-4.2' + sysconfig.get_config_var = gcv + with EnvironmentVarGuard() as env: + env['CC'] = 'my_cc' + env['LDSHARED'] = 'my_ld -bundle -dynamic' + sysconfig.customize_compiler(self.cc) + self.assertEqual(self.cc.linker_so[0], 'my_ld') + + def test_suite(): return unittest.makeSuite(UnixCCompilerTestCase) |