From 3d131ece589cbe0a167328e78bf79985f5fb43fb Mon Sep 17 00:00:00 2001 From: Ines KCHELFI Date: Fri, 16 May 2025 11:09:11 +0200 Subject: insane.bbclass: Add unimplemented-ptest detection for cargo-based tests Extend unimplemented-ptest QA check to detect Rust tests. Note: To enable this QA check, add the following to your local.conf: WARN_QA += "unimplemented-ptest" Examples of Rust-based meta-oe packages triggering unimplemented-ptest: WARNING: cbindgen-0.28.0-r0 do_patch: QA Issue: cbindgen: cargo-based tests detected [unimplemented-ptest] WARNING: fdfindd-10.2-r0 do_patch: QA Issue: fdfindd: cargo-based tests detected [unimplemented-ptest] WARNING: deqp-runner-0.20.3-r0 do_patch: QA Issue: deqp-runner: cargo-based tests detected [unimplemented-ptest] WARNING: bindgen-cli-0.71.1-r0 do_patch: QA Issue: bindgen-cli: cargo-based tests detected [unimplemented-ptest] WARNING: python3-maturin-1.8.3-r0 do_patch: QA Issue: python3-maturin: cargo-based tests detected [unimplemented-ptest] WARNING: uutils-coreutils-0.0.30-r0 do_patch: QA Issue: uutils-coreutils: cargo-based tests detected [unimplemented-ptest] (From OE-Core rev: c3c10f00b1f4d4a092e5d3834ec0ba6abd6ac969) Signed-off-by: Ines KCHELFI Reviewed-by: Yoann Congal Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/classes-global/insane.bbclass | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index cd26bf5eb9..152bef8ad5 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass @@ -1332,6 +1332,13 @@ 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) + # Detect cargo-based tests + elif os.path.exists(os.path.join(srcdir, "Cargo.toml")) and ( + match_line_in_files(srcdir, "**/*.rs", r'\s*#\s*\[\s*test\s*\]') or + match_line_in_files(srcdir, "**/*.rs", r'\s*#\s*\[\s*cfg\s*\(\s*test\s*\)\s*\]') + ): + oe.qa.handle_error("unimplemented-ptest", "%s: cargo-based tests detected" % d.getVar('PN'), d) + # Last resort, detect a test directory in sources elif os.path.exists(srcdir) and 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) -- cgit v1.2.3-54-g00ecf