The buildtools-extended tarball includes GCC, which relies on being
relocated correctly to work.  Add a test case that verifies that the
loader paths have all been relocated, as otherwise there are
hard-to-debug errors at build time.

Signed-off-by: Ross Burton <ross.bur...@arm.com>
---
 meta/lib/oeqa/sdk/buildtools-cases/gcc.py | 29 +++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 meta/lib/oeqa/sdk/buildtools-cases/gcc.py

diff --git a/meta/lib/oeqa/sdk/buildtools-cases/gcc.py 
b/meta/lib/oeqa/sdk/buildtools-cases/gcc.py
new file mode 100644
index 00000000000..36ba15b1340
--- /dev/null
+++ b/meta/lib/oeqa/sdk/buildtools-cases/gcc.py
@@ -0,0 +1,29 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+import os.path
+from oeqa.sdk.case import OESDKTestCase
+
+class GccTests(OESDKTestCase):
+    def test_verify_specs(self):
+        """
+        Verify that the compiler has been relocated successfully and isn't
+        looking in the hard-coded prefix.
+        """
+        # Canonicalise the SDK root
+        sdk_base = os.path.realpath(self.tc.sdk_dir)
+        # Canonicalise the location of GCC
+        gcc_path = os.path.realpath(self._run("command -v gcc").strip())
+        # Skip the test if the GCC didn't come from the buildtools, as it only
+        # comes with buildtools-extended-tarball.
+        if os.path.commonprefix((sdk_base, gcc_path)) != sdk_base:
+            self.skipTest("Buildtools does not provide GCC")
+
+        # This is the prefix that GCC is build with, and should be replaced at
+        # installation time.
+        sdkpath = self.td.get("SDKPATH")
+        self.assertTrue(sdkpath)
+
+        for line in self._run('gcc -dumpspecs').splitlines():
+            self.assertNotIn(sdkpath, line)
-- 
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#154902): 
https://lists.openembedded.org/g/openembedded-core/message/154902
Mute This Topic: https://lists.openembedded.org/mt/84960404/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to