diff options
| author | Ines KCHELFI <ines.kchelfi@smile.fr> | 2025-04-24 14:32:16 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-04-29 09:55:32 +0100 |
| commit | 40346626ec9bb5d0b12bab602da52181f2e3551f (patch) | |
| tree | 7ac3afb2a8a4beb66426ddf738b9cdff570c2055 /meta/classes-recipe/ptest-cargo.bbclass | |
| parent | c2aec3f86ccd2dbe6185f3df2b22a6873582b457 (diff) | |
| download | poky-40346626ec9bb5d0b12bab602da52181f2e3551f.tar.gz | |
ptest-cargo: refactor run-ptest generation to remove redundancy
This refactoring simplifies the generation of the run-ptest script by
removing redundant logic and improving readability.
(From OE-Core rev: 287614a847651f8bd528597b7d6ccb8ad8262367)
Signed-off-by: Ines KCHELFI <ines.kchelfi@smile.fr>
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/ptest-cargo.bbclass')
| -rw-r--r-- | meta/classes-recipe/ptest-cargo.bbclass | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass index 198110a81a..d19617aa50 100644 --- a/meta/classes-recipe/ptest-cargo.bbclass +++ b/meta/classes-recipe/ptest-cargo.bbclass | |||
| @@ -98,17 +98,19 @@ python do_install_ptest_cargo() { | |||
| 98 | test_paths.append(os.path.join(ptest_path, os.path.basename(test_bin))) | 98 | test_paths.append(os.path.join(ptest_path, os.path.basename(test_bin))) |
| 99 | 99 | ||
| 100 | ptest_script = os.path.join(ptest_dir, "run-ptest") | 100 | ptest_script = os.path.join(ptest_dir, "run-ptest") |
| 101 | if os.path.exists(ptest_script): | 101 | script_exists = os.path.exists(ptest_script) |
| 102 | with open(ptest_script, "a") as f: | 102 | with open(ptest_script, "a") as f: |
| 103 | if not script_exists: | ||
| 104 | f.write("#!/bin/sh\n") | ||
| 105 | |||
| 106 | else: | ||
| 103 | f.write(f"\necho \"\"\n") | 107 | f.write(f"\necho \"\"\n") |
| 104 | f.write(f"echo \"## starting to run rust tests ##\"\n") | 108 | f.write(f"echo \"## starting to run rust tests ##\"\n") |
| 105 | for test_path in test_paths: | 109 | |
| 106 | f.write(f"{test_path} {rust_test_args}\n") | 110 | for test_path in test_paths: |
| 107 | else: | 111 | f.write(f"{test_path} {rust_test_args}\n") |
| 108 | with open(ptest_script, "a") as f: | 112 | |
| 109 | f.write("#!/bin/sh\n") | 113 | if not script_exists: |
| 110 | for test_path in test_paths: | ||
| 111 | f.write(f"{test_path} {rust_test_args}\n") | ||
| 112 | os.chmod(ptest_script, 0o755) | 114 | os.chmod(ptest_script, 0o755) |
| 113 | 115 | ||
| 114 | # this is chown -R root:root ${D}${PTEST_PATH} | 116 | # this is chown -R root:root ${D}${PTEST_PATH} |
