From 177c47b7decd8e2d1e24738d10b0f7db2777a772 Mon Sep 17 00:00:00 2001 From: Yoann Congal Date: Thu, 28 Aug 2025 20:13:23 +0200 Subject: [PATCH] ptest-cargo: move run-ptest rc variable initialisation ptest-cargo run-ptest can be generated in two fashions: generated from scratch or appended to an exiting run-ptest file. The rc variable used to track tests failure was only initialized in "generated from scratch" case. Which lead to errors in the "appended" case. Move the rc variable initialisation to the common code of both case to fix this problem. Only initialize rc if it was not already affected in the recipe provided run-ptest. Signed-off-by: Yoann Congal Cc: Gyorgy Sarvari Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/classes-recipe/ptest-cargo.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass index ece25ff1eb..8351644b0f 100644 --- a/meta/classes-recipe/ptest-cargo.bbclass +++ b/meta/classes-recipe/ptest-cargo.bbclass @@ -103,10 +103,10 @@ python do_install_ptest_cargo() { with open(ptest_script, "a") as f: if not script_exists: f.write("#!/bin/sh\n") - f.write("rc=0\n") else: f.write(f"\necho \"\"\n") f.write(f"echo \"## starting to run rust tests ##\"\n") + f.write("if [ -z \"$rc\" ]; then rc=0; fi\n") for test_path in test_paths: script = textwrap.dedent(f"""\ if ! {test_path} {rust_test_args} -- 2.47.3