diff options
-rw-r--r-- | meta/classes-recipe/ptest-cargo.bbclass | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass index f28bc7a826..4ed528445a 100644 --- a/meta/classes-recipe/ptest-cargo.bbclass +++ b/meta/classes-recipe/ptest-cargo.bbclass | |||
@@ -1,5 +1,8 @@ | |||
1 | inherit cargo ptest | 1 | inherit cargo ptest |
2 | 2 | ||
3 | RUST_TEST_ARGS ??= "" | ||
4 | RUST_TEST_ARGS[doc] = "Arguments to give to the test binaries (e.g. --shuffle)" | ||
5 | |||
3 | # I didn't find a cleaner way to share data between compile and install tasks | 6 | # I didn't find a cleaner way to share data between compile and install tasks |
4 | CARGO_TEST_BINARIES_FILES ?= "${B}/test_binaries_list" | 7 | CARGO_TEST_BINARIES_FILES ?= "${B}/test_binaries_list" |
5 | 8 | ||
@@ -74,6 +77,7 @@ python do_install_ptest_cargo() { | |||
74 | pn = d.getVar("PN", True) | 77 | pn = d.getVar("PN", True) |
75 | ptest_path = d.getVar("PTEST_PATH", True) | 78 | ptest_path = d.getVar("PTEST_PATH", True) |
76 | cargo_test_binaries_file = d.getVar('CARGO_TEST_BINARIES_FILES', True) | 79 | cargo_test_binaries_file = d.getVar('CARGO_TEST_BINARIES_FILES', True) |
80 | rust_test_args = d.getVar('RUST_TEST_ARGS') or "" | ||
77 | 81 | ||
78 | ptest_dir = os.path.join(dest_dir, ptest_path.lstrip('/')) | 82 | ptest_dir = os.path.join(dest_dir, ptest_path.lstrip('/')) |
79 | os.makedirs(ptest_dir, exist_ok=True) | 83 | os.makedirs(ptest_dir, exist_ok=True) |
@@ -94,12 +98,12 @@ python do_install_ptest_cargo() { | |||
94 | f.write(f"\necho \"\"\n") | 98 | f.write(f"\necho \"\"\n") |
95 | f.write(f"echo \"## starting to run rust tests ##\"\n") | 99 | f.write(f"echo \"## starting to run rust tests ##\"\n") |
96 | for test_path in test_paths: | 100 | for test_path in test_paths: |
97 | f.write(f"{test_path}\n") | 101 | f.write(f"{test_path} {rust_test_args}\n") |
98 | else: | 102 | else: |
99 | with open(ptest_script, "a") as f: | 103 | with open(ptest_script, "a") as f: |
100 | f.write("#!/bin/sh\n") | 104 | f.write("#!/bin/sh\n") |
101 | for test_path in test_paths: | 105 | for test_path in test_paths: |
102 | f.write(f"{test_path}\n") | 106 | f.write(f"{test_path} {rust_test_args}\n") |
103 | os.chmod(ptest_script, 0o755) | 107 | os.chmod(ptest_script, 0o755) |
104 | 108 | ||
105 | # this is chown -R root:root ${D}${PTEST_PATH} | 109 | # this is chown -R root:root ${D}${PTEST_PATH} |