Message ID | 20250516090910.972704-2-ines.kchelfi@smile.fr |
---|---|
State | New |
Headers | show |
Series | insane.bbclass: Add unimplemented-ptest detection for cargo-based tests | expand |
Le ven. 16 mai 2025 à 11:09, Ines KCHELFI via lists.openembedded.org <ines.kchelfi=smile.fr@lists.openembedded.org> a écrit : > From: Ines KCHELFI <ines.kchelfi@smile.fr> > > 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] > > Signed-off-by: Ines KCHELFI <ines.kchelfi@smile.fr> > Reviewed-by: Yoann Congal <yoann.congal@smile.fr> > --- > 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) > -- > 2.43.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#216726): > https://lists.openembedded.org/g/openembedded-core/message/216726 > Mute This Topic: https://lists.openembedded.org/mt/113142168/4316185 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > yoann.congal@smile.fr] > -=-=-=-=-=-=-=-=-=-=-=- > >
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)