]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
ptest-cargo: move run-ptest rc variable initialisation
authorYoann Congal <yoann.congal@smile.fr>
Thu, 28 Aug 2025 18:13:23 +0000 (20:13 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 1 Sep 2025 22:07:03 +0000 (23:07 +0100)
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 <yoann.congal@smile.fr>
Cc: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/ptest-cargo.bbclass

index ece25ff1eb194bf9a2c9c9a78f71b73c5f380909..8351644b0f4c74ae2499a374d4f67eacfaa77ba9 100644 (file)
@@ -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}