diff mbox series

[2/4] oeqa: add insane package walk test

Message ID 20191209122007.13306-2-ross.burton@intel.com
State New
Headers show
Series [1/4] selftest-hardlink: don't RDEPEND on gdb explicitly | expand

Commit Message

Ross Burton Dec. 9, 2019, 12:20 p.m. UTC
For reassurance when changing the insane.bbclass package walking code,
add a sanity test to verify that the file listing is what is expected.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta-selftest/classes/insane-test.bbclass |  4 +++
 meta/lib/oeqa/selftest/cases/package.py   | 38 +++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 meta-selftest/classes/insane-test.bbclass

-- 
2.20.1

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta-selftest/classes/insane-test.bbclass b/meta-selftest/classes/insane-test.bbclass
new file mode 100644
index 00000000000..aafb0031a5b
--- /dev/null
+++ b/meta-selftest/classes/insane-test.bbclass
@@ -0,0 +1,4 @@ 
+QAPATHTEST[selftest-walk] = "package_qa_check_selftest_walk"
+def package_qa_check_selftest_walk(path, pkg, d, elf, messages):
+    path = package_qa_clean_path(path, d, pkg)
+    bb.warn("WALK %s %s %s" % (pkg, path, "ELF" if elf else "FILE"))
diff --git a/meta/lib/oeqa/selftest/cases/package.py b/meta/lib/oeqa/selftest/cases/package.py
index c6444062674..d9725b4f2a3 100644
--- a/meta/lib/oeqa/selftest/cases/package.py
+++ b/meta/lib/oeqa/selftest/cases/package.py
@@ -148,3 +148,41 @@  class PackageTests(OESelftestTestCase):
                            '/usr/libexec/hello4']:
                 if not gdbtest(qemu, binary):
                     self.fail('GDB %s failed' % binary)
+
+
+class InsaneTest(OESelftestTestCase):
+    def test_insane_package_walk(self):
+        """
+        Check that the package walking in insane.bbclass is listing the files we
+        expect.
+        """
+
+        import re
+
+        config = """
+INHERIT += "insane-test"
+WARN_QA_append_pn-selftest-hardlink = " selftest-walk"
+        """
+        self.write_config(config)
+
+        result = bitbake("selftest-hardlink -c package_qa -f")
+        expected = set((
+            "selftest-hardlink:/usr/libexec/hello3:ELF",
+            "selftest-hardlink:/usr/libexec/hello4:ELF",
+            "selftest-hardlink:/usr/bin/sparsetest:FILE",
+            "selftest-hardlink:/usr/bin/gdb.sh:FILE",
+            "selftest-hardlink:/usr/bin/hello1:ELF",
+            "selftest-hardlink:/usr/bin/hello2:ELF",
+            "selftest-hardlink-dbg:/usr/libexec/.debug/hello1:ELF",
+            "selftest-hardlink-dbg:/usr/bin/.debug/hello1:ELF",
+            "selftest-hardlink-src:/usr/src/debug/selftest-hardlink/1.0-r0/hello.c:FILE"
+        ))
+
+        line_re = re.compile(r"^WARNING: WALK (.+) (.+) (FILE|ELF)$")
+        for line in result.output.splitlines():
+            m = line_re.match(line)
+            if m:
+                expected.remove(":".join(m.groups()))
+
+        if expected:
+            self.fail("Not all files were listed: " + str(expected))