]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
patchtest/selftest: Extract head-attached test loop into function
authorNaftaly RALAMBOARIVONY <naftaly.ralamboarivony@smile.fr>
Thu, 11 Dec 2025 15:06:44 +0000 (16:06 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 15 Dec 2025 18:00:31 +0000 (18:00 +0000)
Move the loop that run the tests in head attached tests into a function
'test_head_attached'. Also add an explicit check for the case where no patches
are found and exit with an error.

Signed-off-by: Naftaly RALAMBOARIVONY <naftaly.ralamboarivony@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/patchtest/selftest/selftest

index a1be478e1ac765c7266735b20a488f24556bac93..92acc4d556ba4c58c1d02fc7cb4577260aedd965 100755 (executable)
@@ -95,6 +95,12 @@ def test(root, patch):
 
     return results
 
+def test_head_attached(patches, counts):
+    for patch_info in patches:
+        results = test(patch_info["root"], patch_info["patch"])
+        counts = analyze_result(results, patch_info, counts)
+    return counts
+
 if __name__ == '__main__':
     counts = {
         "pass": 0,
@@ -107,8 +113,10 @@ if __name__ == '__main__':
     }
 
     results = None
+
     patches = get_patches(patchesdir)
-    for patch_info in patches:
-        results = test(patch_info["root"], patch_info["patch"])
-        counts = analyze_result(results, patch_info, counts)
+    if not patches:
+        print(f"Error: Unable to find patch(es) in {patchesdir}")
+        sys.exit(1)
+    counts = test_head_attached(patches, counts)
     print_results(counts)