blob: a62c4d0bc4fcccd527f0c10f512a16f50808521f [file] [log] [blame]
Andrew Geisslerd159c7f2021-09-02 21:05:58 -05001#
Patrick Williams92b42cb2022-09-03 06:53:57 -05002# Copyright OpenEmbedded Contributors
3#
Andrew Geisslerd159c7f2021-09-02 21:05:58 -05004# SPDX-License-Identifier: MIT
5#
6
7import os.path
8from oeqa.sdk.case import OESDKTestCase
9
10class GccTests(OESDKTestCase):
11 def test_verify_specs(self):
12 """
13 Verify that the compiler has been relocated successfully and isn't
14 looking in the hard-coded prefix.
15 """
16 # Canonicalise the SDK root
17 sdk_base = os.path.realpath(self.tc.sdk_dir)
18 # Canonicalise the location of GCC
19 gcc_path = os.path.realpath(self._run("command -v gcc").strip())
20 # Skip the test if the GCC didn't come from the buildtools, as it only
21 # comes with buildtools-extended-tarball.
22 if os.path.commonprefix((sdk_base, gcc_path)) != sdk_base:
23 self.skipTest("Buildtools does not provide GCC")
24
25 # This is the prefix that GCC is build with, and should be replaced at
26 # installation time.
27 sdkpath = self.td.get("SDKPATH")
28 self.assertTrue(sdkpath)
29
30 for line in self._run('gcc -dumpspecs').splitlines():
31 self.assertNotIn(sdkpath, line)