[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-core] [PATCH 3/4] QA, ptest: Detect build-system test harnesses
From:       "Yoann Congal" <yoann.congal () smile ! fr>
Date:       2023-09-29 22:05:02
Message-ID: 20230929220503.3169745-4-yoann.congal () smile ! fr
[Download RAW message or body]

From: Jérémy Rosen <jeremy.rosen@smile.fr>

most build-systems have a way to implement a "make check" or equivalent
command that will run tests in the source directory.

This heuristic will detect the keywords in the build-system configuration
that activates tests.

Note that in the case of autotools, we use Makefile.in as our source
instead of Makefile.am to easily follow includes. Filenaming conventions
for autotools files are not reliable enough to do naive matching.

Signed-off-by: Jérémy Rosen <jeremy.rosen@smile.fr>
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
---
 meta/classes-global/insane.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index 31db707a33..a5d3793265 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -1386,6 +1386,18 @@ python do_qa_patch() {
     elif match_line_in_files(srcdir, "**/*.py", \
                r'\s*(?:import\s*pytest|from\s*pytest)'):
         oe.qa.handle_error("unimplemented-ptest", "%s: pytest-based tests detected" \
% d.getVar('PN'), d)  
+    # Detect meson-based tests
+    elif os.path.exists(os.path.join(srcdir, "meson.build")) and \
match_line_in_files(srcdir, "**/meson.build", r'\s*test\s*\('): +        \
oe.qa.handle_error("unimplemented-ptest", "%s: meson-based tests detected" % \
d.getVar('PN'), d) +
+    # Detect cmake-based tests
+    elif os.path.exists(os.path.join(srcdir, "CMakelists.txt")) and \
match_line_in_files(srcdir, "**/CMakeLists.txt", \
r'\s*(?:add_test|enable_testing)\s*\('): +        \
oe.qa.handle_error("unimplemented-ptest", "%s: cmake-based tests detected" % \
d.getVar('PN'), d) +
+    # Detect autotools-based ·tests
+    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) +
     oe.qa.exit_if_errors(d)
 }
 
-- 
2.30.2



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#188451): https://lists.openembedded.org/g/openembedded-core/message/188451
Mute This Topic: https://lists.openembedded.org/mt/101667587/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic