diff options
| author | Ines KCHELFI <ines.kchelfi@smile.fr> | 2025-05-12 16:44:11 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-15 10:55:26 +0100 |
| commit | 931ff89bdc9559910fe8852d0a047cfbea51e8fe (patch) | |
| tree | bea29d7e56b7ea1162fb7d5217fc5989bb30e228 | |
| parent | c07c578e37d6ced3828343d881a861237d6db567 (diff) | |
| download | poky-931ff89bdc9559910fe8852d0a047cfbea51e8fe.tar.gz | |
ptest-cargo: fix tests output format for testimage
In testimage, the ptest-runner output parser expects test results to follow
a specific format,with lines beginning with PASS:, FAIL:, or SKIP:. ptest-cargo,
currently, does not emit any of those lines and the parser treats the test
section as having no results, causing a test failure with :
AssertionError:
ptests which had no test results:
['<package>']
This patch ensures that the recipes using ptest-cargo class explicitly emits
PASS: or FAIL: lines, making the results compatible with the test parser and
preventing test failures.
(From OE-Core rev: 6a9356346f13556a06d4a99bd7924992c7e29d66)
Signed-off-by: Ines KCHELFI <ines.kchelfi@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes-recipe/ptest-cargo.bbclass | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass index 7b18d43c38..ece25ff1eb 100644 --- a/meta/classes-recipe/ptest-cargo.bbclass +++ b/meta/classes-recipe/ptest-cargo.bbclass | |||
| @@ -77,6 +77,7 @@ python do_compile_ptest_cargo() { | |||
| 77 | 77 | ||
| 78 | python do_install_ptest_cargo() { | 78 | python do_install_ptest_cargo() { |
| 79 | import shutil | 79 | import shutil |
| 80 | import textwrap | ||
| 80 | 81 | ||
| 81 | dest_dir = d.getVar("D") | 82 | dest_dir = d.getVar("D") |
| 82 | pn = d.getVar("PN") | 83 | pn = d.getVar("PN") |
| @@ -107,7 +108,16 @@ python do_install_ptest_cargo() { | |||
| 107 | f.write(f"\necho \"\"\n") | 108 | f.write(f"\necho \"\"\n") |
| 108 | f.write(f"echo \"## starting to run rust tests ##\"\n") | 109 | f.write(f"echo \"## starting to run rust tests ##\"\n") |
| 109 | for test_path in test_paths: | 110 | for test_path in test_paths: |
| 110 | f.write(f"if ! {test_path} {rust_test_args}; then rc=1; fi\n") | 111 | script = textwrap.dedent(f"""\ |
| 112 | if ! {test_path} {rust_test_args} | ||
| 113 | then | ||
| 114 | rc=1 | ||
| 115 | echo "FAIL: {test_path}" | ||
| 116 | else | ||
| 117 | echo "PASS: {test_path}" | ||
| 118 | fi | ||
| 119 | """) | ||
| 120 | f.write(script) | ||
| 111 | 121 | ||
| 112 | f.write("exit $rc\n") | 122 | f.write("exit $rc\n") |
| 113 | 123 | ||
