summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes-recipe/ptest-cargo.bbclass12
1 files changed, 8 insertions, 4 deletions
diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass
index 5d53abe969..ff57be8525 100644
--- a/meta/classes-recipe/ptest-cargo.bbclass
+++ b/meta/classes-recipe/ptest-cargo.bbclass
@@ -16,6 +16,8 @@ python do_compile_ptest_cargo() {
16 cargo_build_flags = d.getVar("CARGO_BUILD_FLAGS", True) 16 cargo_build_flags = d.getVar("CARGO_BUILD_FLAGS", True)
17 rust_flags = d.getVar("RUSTFLAGS", True) 17 rust_flags = d.getVar("RUSTFLAGS", True)
18 manifest_path = d.getVar("MANIFEST_PATH", True) 18 manifest_path = d.getVar("MANIFEST_PATH", True)
19 project_manifest_path = os.path.normpath(manifest_path)
20 manifest_dir = os.path.dirname(manifest_path)
19 21
20 env = os.environ.copy() 22 env = os.environ.copy()
21 env['RUSTFLAGS'] = rust_flags 23 env['RUSTFLAGS'] = rust_flags
@@ -46,13 +48,15 @@ python do_compile_ptest_cargo() {
46 pass 48 pass
47 else: 49 else:
48 try: 50 try:
49 # Filter the test packages coming from the current manifest 51 # Filter the test packages coming from the current project:
52 # - test binaries from the root manifest
53 # - test binaries from sub manifest of the current project if any
50 current_manifest_path = os.path.normpath(data['manifest_path']) 54 current_manifest_path = os.path.normpath(data['manifest_path'])
51 project_manifest_path = os.path.normpath(manifest_path) 55 common_path = os.path.commonpath([current_manifest_path, project_manifest_path])
52 if current_manifest_path == project_manifest_path: 56 if common_path in [manifest_dir, current_manifest_path]:
53 if (data['target']['test'] or data['target']['doctest']) and data['executable']: 57 if (data['target']['test'] or data['target']['doctest']) and data['executable']:
54 test_bins.append(data['executable']) 58 test_bins.append(data['executable'])
55 except KeyError as e: 59 except (KeyError, ValueError) as e:
56 # skip lines that do not meet the requirements 60 # skip lines that do not meet the requirements
57 pass 61 pass
58 62