OpenCL-CTS
OpenCL-CTS copied to clipboard
conventions for `int` return values
Throughout the CTS, many functions return int, but for different purposes. Sometimes, the int is an OpenCL error code. In other places, the int is the test status, such as whether the test passed, failed or was skipped.
It is very difficult to keep the different meanings of the int return value correct, and is is very common to unintentionally return an OpenCL error code instead of a test status. Because both CL_SUCCESS and TEST_PASS both have the value (zero), this mistake does usually does not cause an issue in practice, though there are no guarantees this is the case now or in the future.
Is this something we want to fix? I think this could take one of two forms:
- Embrace that the test status and OpenCL errors can be intermixed and stop trying to differentiate between the two.
- The value zero will always indicate that the test passed, regardless whether it is
CL_SUCCESSorTEST_PASS. - If we switched
TEST_FAILto be a negative value, a negative value could always indicate that the test failed, regardless whether it is an OpenCL error code orTEST_FAIL. - If we switched
TEST_SKIPPED_ITSELFto be a positive value, a positive value coudl always indicate that the test was skipped. - Note, if we did this, we could clean up parts of the harness; for example, we wouldn't need both
test_errorandtest_error_fail.
- The value zero will always indicate that the test passed, regardless whether it is
- Use a strongly typed test status instead, which would make it impossible to mix the two.