[2/2] image-without-static-linkage: add selftest

Message ID 20220704162504.1488894-2-johannes.schilling@methodpark.de
State New
Headers show
Series [1/2] image-without-static-linkage: add class | expand

Commit Message

Johannes Schilling July 4, 2022, 4:25 p.m. UTC

Patch

diff --git a/lib/oeqa/selftest/cases/static_linkage_checker.py b/lib/oeqa/selftest/cases/static_linkage_checker.py
new file mode 100644
index 0000000..a5fdf6b
--- /dev/null
+++ b/lib/oeqa/selftest/cases/static_linkage_checker.py
@@ -0,0 +1,39 @@ 
+import os
+import re
+
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake
+
+class StaticLinkageCheck(OESelftestTestCase):
+    def test_static_linkage_check(self):
+        self.write_recipeinc('emptytest', """
+SUMMARY = "A small image just capable of allowing a device to boot."
+
+IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL}"
+
+CORE_IMAGE_EXTRA_INSTALL ?= ""
+
+LICENSE = "MIT"
+
+inherit image
+
+IMAGE_ROOTFS_SIZE ?= "8192"
+
+inherit image-without-static-linkage
+
+STATIC_LINKAGE_CHECK_CONFIG = "${WORKDIR}/static-linkage-check-config.toml"
+
+do_write_config() {
+    echo "[checkers]\nmodules = [ "zlib", "librsvg" ]\n" > "${STATIC_LINKAGE_CHECK_CONFIG}"
+    echo "[exceptions]" >> "${STATIC_LINKAGE_CHECK_CONFIG}"
+    echo "ignore_dirs = []" >> "${STATIC_LINKAGE_CHECK_CONFIG}"
+    echo "ignore_checks = {}" >> "${STATIC_LINKAGE_CHECK_CONFIG}"
+}
+
+addtask do_write_config before do_image_qa
+        """)
+
+        result = bitbake("-c image_qa emptytest", ignore_status=True)
+        if result.status != 0:
+            self.logger.warn(result.output)
+            raise self.failureException("build failed, something went wrong...")