Fix error handling logic in test_kernel_call_kernel_function (#2714)
Some checks failed
Presubmit / Build ubuntu-22.04 gl (push) Failing after 1s
Presubmit / Build ubuntu-22.04 aarch64 debug (push) Failing after 1s
Presubmit / Build ubuntu-22.04 android-aarch64 (push) Failing after 1s
Presubmit / Check code format (push) Failing after 1s
Presubmit / Build macos-latest (push) Has been cancelled
Presubmit / Build windows-11-arm (push) Has been cancelled
Presubmit / Build windows-latest (push) Has been cancelled
Presubmit / Run Tests (pocl) (push) Has been cancelled
Some checks failed
Presubmit / Build ubuntu-22.04 gl (push) Failing after 1s
Presubmit / Build ubuntu-22.04 aarch64 debug (push) Failing after 1s
Presubmit / Build ubuntu-22.04 android-aarch64 (push) Failing after 1s
Presubmit / Check code format (push) Failing after 1s
Presubmit / Build macos-latest (push) Has been cancelled
Presubmit / Build windows-11-arm (push) Has been cancelled
Presubmit / Build windows-latest (push) Has been cancelled
Presubmit / Run Tests (pocl) (push) Has been cancelled
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.
This commit is contained in:
parent
f769e2ab64
commit
8d8f3d272d
1 changed files with 39 additions and 27 deletions
|
|
@ -125,19 +125,23 @@ REGISTER_TEST(kernel_call_kernel_function)
|
|||
|
||||
// Compare the results
|
||||
pass = 1;
|
||||
int subtest_errors = 0;
|
||||
for (int i=0; i<num_elements; i++) {
|
||||
if (output[i] != expected[i]) {
|
||||
if (errors > 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<num_elements; i++) {
|
||||
if (output[i] != expected[i]) {
|
||||
if (errors > 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<num_elements; i++) {
|
||||
if (output[i] != expected[i]) {
|
||||
if (errors > 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 );
|
||||
|
|
|
|||
Loading…
Reference in a new issue