From 8d8f3d272dbd3f0a84156be7890835c4b6deff8e Mon Sep 17 00:00:00 2001 From: Jose Lopez Date: Tue, 9 Jun 2026 17:31:48 +0100 Subject: [PATCH] Fix error handling logic in test_kernel_call_kernel_function (#2714) Fixes the following issues: 1. Incorrect suppression condition in sections 2 & 3 Both sections use if (errors > 10) twice instead of having a trigger condition (errors == 10). As a result, the "Suppressing further results..." message never prints, and errors are skipped silently. 2. Incorrect pass reporting in section 3 Since errors are global, earlier sub-tests may already push it beyond 10. Section 3 then immediately skips error handling (due to errors > 10), including setting pass = 0, and incorrectly reports "Passed" even when errors occur. 3. Repeated suppression message in section 1 When errors == 10, the code prints the suppression message and continues without incrementing errors. This causes the condition to remain true, printing the message repeatedly for every subsequent error instead of just once, while doing nothing else. --- .../test_kernel_call_kernel_function.cpp | 66 +++++++++++-------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/test_conformance/basic/test_kernel_call_kernel_function.cpp b/test_conformance/basic/test_kernel_call_kernel_function.cpp index 82cb1a65..fd0fd83d 100644 --- a/test_conformance/basic/test_kernel_call_kernel_function.cpp +++ b/test_conformance/basic/test_kernel_call_kernel_function.cpp @@ -125,19 +125,23 @@ REGISTER_TEST(kernel_call_kernel_function) // Compare the results pass = 1; + int subtest_errors = 0; for (int i=0; i 10) - continue; - if (errors == 10) { - log_error("Suppressing further results...\n"); - continue; - } - log_error("Results do not match: output[%d]=%d != expected[%d]=%d\n", i, output[i], i, expected[i]); - errors++; + if (output[i] != expected[i]) + { + subtest_errors++; pass = 0; + log_error( + "Results do not match: output[%d]=%d != expected[%d]=%d\n", i, + output[i], i, expected[i]); + if (subtest_errors == 10) + { + log_error("Suppressing further results...\n"); + break; + } } } + errors += subtest_errors; if (pass) log_info("Passed kernel calling kernel...\n"); @@ -172,19 +176,23 @@ REGISTER_TEST(kernel_call_kernel_function) // Compare the results pass = 1; + subtest_errors = 0; for (int i=0; i 10) - continue; - if (errors > 10) { - log_error("Suppressing further results...\n"); - continue; - } - log_error("Results do not match: output[%d]=%d != expected[%d]=%d\n", i, output[i], i, expected[i]); - errors++; + if (output[i] != expected[i]) + { + subtest_errors++; pass = 0; + log_error( + "Results do not match: output[%d]=%d != expected[%d]=%d\n", i, + output[i], i, expected[i]); + if (subtest_errors == 10) + { + log_error("Suppressing further results...\n"); + break; + } } } + errors += subtest_errors; if (pass) log_info("Passed kernel calling function...\n"); @@ -227,19 +235,23 @@ REGISTER_TEST(kernel_call_kernel_function) // Compare the results pass = 1; + subtest_errors = 0; for (int i=0; i 10) - continue; - if (errors > 10) { - log_error("Suppressing further results...\n"); - continue; - } - log_error("Results do not match: output[%d]=%d != expected[%d]=%d\n", i, output[i], i, expected[i]); - errors++; + if (output[i] != expected[i]) + { + subtest_errors++; pass = 0; + log_error( + "Results do not match: output[%d]=%d != expected[%d]=%d\n", i, + output[i], i, expected[i]); + if (subtest_errors == 10) + { + log_error("Suppressing further results...\n"); + break; + } } } + errors += subtest_errors; if (pass) log_info("Passed calling the kernel we called from another kernel before...\n"); free( input );