From: Naftaly RALAMBOARIVONY Date: Thu, 11 Dec 2025 15:06:44 +0000 (+0100) Subject: patchtest/selftest: Extract head-attached test loop into function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cdb5cbbee6281af1b71407da0d0af74dc7b9631;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git patchtest/selftest: Extract head-attached test loop into function 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 Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- diff --git a/meta/lib/patchtest/selftest/selftest b/meta/lib/patchtest/selftest/selftest index a1be478e1a..92acc4d556 100755 --- a/meta/lib/patchtest/selftest/selftest +++ b/meta/lib/patchtest/selftest/selftest @@ -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)