]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
insane: Add a naive heuristic to detect test subdirectories
authorJérémy Rosen <jeremy.rosen@smile.fr>
Tue, 10 Oct 2023 13:49:31 +0000 (15:49 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 15 Oct 2023 08:11:40 +0000 (09:11 +0100)
if there is a "test" or "tests" subdirectory at toplevel, this usually
means we have some unit tests available.

This test is very good at detecting handcrafted tests and I was not able
to find any false positive.

False positive can be dealt with the usual INSANE_SKIP mechanism

Signed-off-by: Jérémy Rosen <jeremy.rosen@smile.fr>
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
meta/classes-global/insane.bbclass

index 3fa9da8aff1ee7d0c48944c7ab619a4d3b419994..07de974a54646e9f9ec9a0f57424a8198721b918 100644 (file)
@@ -1391,6 +1391,10 @@ python do_qa_patch() {
     elif os.path.exists(os.path.join(srcdir, "Makefile.in")) and (match_line_in_files(srcdir, "**/Makefile.in", r'\s*TESTS\s*\+?=') or match_line_in_files(srcdir,"**/*.at",r'.*AT_INIT')):
         oe.qa.handle_error("unimplemented-ptest", "%s: autotools-based tests detected" % d.getVar('PN'), d)
 
+    # Last resort, detect a test directory in sources
+    elif any(filename.lower() in ["test", "tests"] for filename in os.listdir(srcdir)):
+        oe.qa.handle_error("unimplemented-ptest", "%s: test subdirectory detected" % d.getVar('PN'), d)
+
     oe.qa.exit_if_errors(d)
 }