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