]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
ptest-cargo: handle packageconfig arguments
authorPeter Marko <peter.marko@siemens.com>
Tue, 22 Apr 2025 12:29:51 +0000 (14:29 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 24 Apr 2025 10:25:00 +0000 (11:25 +0100)
Align cargo options between ptest-cargo and cargo classes.

After oe-core commit 16745b20452de60ae2474433cc1a2fb1ed9f6a64 there is
a discrepancy between cargo arguments in compile and compile-ptest-cargo
steps when packageconfig is used for cargo based recipes.

Currently we have to do something like following code to build ptest
enabled cargo based recipe:
CARGO_BUILD_FLAGS:append:task-compile-ptest-cargo = " ${PACKAGECONFIG_CONFARGS}"
Otherwise the options are either doubled in compile step or completely
missing in compile-ptest-cargo step.

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/ptest-cargo.bbclass

index fd1df9d7c9112acca6c14cab3ab5a8c89913b6b5..198110a81a3f23f4090dfa0dd84e17c8e893b438 100644 (file)
@@ -14,6 +14,7 @@ python do_compile_ptest_cargo() {
 
     cargo = bb.utils.which(d.getVar("PATH"), d.getVar("CARGO"))
     cargo_build_flags = d.getVar("CARGO_BUILD_FLAGS")
+    packageconfig_confargs = d.getVar("PACKAGECONFIG_CONFARGS")
     rust_flags = d.getVar("RUSTFLAGS")
     manifest_path = d.getVar("CARGO_MANIFEST_PATH")
     project_manifest_path = os.path.normpath(manifest_path)
@@ -21,7 +22,7 @@ python do_compile_ptest_cargo() {
 
     env = os.environ.copy()
     env['RUSTFLAGS'] = rust_flags
-    cmd = f"{cargo} build --tests --message-format json {cargo_build_flags}"
+    cmd = f"{cargo} build --tests --message-format json {cargo_build_flags} {packageconfig_confargs}"
     bb.note(f"Building tests with cargo ({cmd})")
 
     try: