diff mbox series

[1/3] ptest-cargo.bbclass: Collect only test binaries and not executables

Message ID 20251112155730.646159-2-andreas.stergiopoulos@smile.fr
State New
Headers show
Series Better support for Rust integration tests | expand

Commit Message

Andreas STERGIOPOULOS Nov. 12, 2025, 3:57 p.m. UTC
This commit changes the files that are collected during compilation of tests. Till now, all the
produced binaries were collected. This commit changes the conditions inside the loop so that only
the binary and integration tests are collected. To do this, the variable "test" of the object
"profile" is examined. Tests are all compiled with the "test" profile, whereas the binaries are
compiled with the "dev" profile.

Signed-off-by: Andreas Stergiopoulos <andreas.stergiopoulos@smile.fr>
---
 meta/classes-recipe/ptest-cargo.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass
index 30463e117b..004abb40f7 100644
--- a/meta/classes-recipe/ptest-cargo.bbclass
+++ b/meta/classes-recipe/ptest-cargo.bbclass
@@ -55,7 +55,8 @@  python do_compile_ptest_cargo() {
                 current_manifest_path = os.path.normpath(data['manifest_path'])
                 common_path = os.path.commonpath([current_manifest_path, project_manifest_path])
                 if common_path in [manifest_dir, current_manifest_path]:
-                    if (data['target']['test'] or data['target']['doctest']) and data['executable']:
+                    # Collect tests (integration and unit) and nothing but tests
+                    if (data['target']['test'] or data['target']['doctest']) and data['executable'] and data['profile']['test']:
                         test_bins.append(data['executable'])
             except (KeyError, ValueError) as e:
                 # skip lines that do not meet the requirements