Skip to content

Make the test programs exit non-zero when an error check fails - #15

Merged
hyfshishen merged 1 commit into
szcompressor:masterfrom
saqibkh:tests-return-failure
Oct 28, 2026
Merged

hyfshishen merged 1 commit into
szcompressor:masterfrom
saqibkh:tests-return-failure

Conversation

@saqibkh

@saqibkh saqibkh commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Each cuSZp_test_* program prints Fail error check! Exceeding data count: N when a result is out of bound, but main always returns 0. So ctest reports every test as passed whatever the outcome. I noticed it by running the tests on a machine with no GPU: the output was full of Fail error check lines and ctest still said 100% passed.

This counts the failed checks in each of the six programs and returns non-zero if there were any.

What I ran, after building with CUDA 13.0 for compute_80 and installing:

  • On a simulated A100 (PantheonSim), cuSZp_test_f32_1D prints three Pass error check lines and exits 0. The other five tests also print only Pass there, but I ran them before this change, so I didn't re-run them with it.
  • With no GPU visible, ctest now fails all 6 tests. Before this change it passed all 6.

The coverage workflow runs ctest -V || true, so nothing changes there. If you'd like it to fail when a test fails, drop the || true, though that needs a runner with a GPU.

I wrote PantheonSim, which is the simulator I used to run these on a machine without a GPU.

Each cuSZp_test_* program printed 'Fail error check!' but always returned 0,
so ctest reported success whatever the result. Count the failed checks and
return non-zero if there were any.
@hyfshishen
hyfshishen merged commit b027990 into szcompressor:master Oct 28, 2026
1 check passed
@hyfshishen

Copy link
Copy Markdown
Collaborator

Thanks for identifying this issue! The changes look good to me. I agree that the tests should return a non-zero exit status when the error-bound checks fail. I just merged it into main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants