From 7f0193e294b731f595ae2c74eef0b4c256f9bb72 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 25 Sep 2021 11:21:35 -0700 Subject: unittests: Make test_prelinking work on Solaris Running 'cc --version' finds the Solaris Studio C compiler, not gcc, and it doesn't support --version. --- unittests/linuxliketests.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'unittests') diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index 2bcf5c9..8631f30 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -1676,10 +1676,13 @@ class LinuxlikeTests(BasePlatformTests): raise SkipTest('Prelinking not supported on Darwin.') if 'clang' in os.environ.get('CC', 'dummy'): raise SkipTest('Prelinking not supported with Clang.') - gccver = subprocess.check_output(['cc', '--version']) - if b'7.5.0' in gccver: - raise SkipTest('GCC on Bionic is too old to be supported.') testdir = os.path.join(self.unit_test_dir, '87 prelinking') + env = get_fake_env(testdir, self.builddir, self.prefix) + cc = detect_c_compiler(env, MachineChoice.HOST) + if cc.id == "gcc": + gccver = subprocess.check_output(['gcc', '--version']) + if b'7.5.0' in gccver: + raise SkipTest('GCC on Bionic is too old to be supported.') self.init(testdir) self.build() outlib = os.path.join(self.builddir, 'libprelinked.a') -- cgit v1.1