OpenCL-Headers icon indicating copy to clipboard operation
OpenCL-Headers copied to clipboard

Generate tests that use all definitions provided by the headers

Open kpet opened this issue 3 years ago • 1 comments

We currently have automated testing in place for a good numbers of compilers, C versions, etc but the test code we're compiling uses almost none of the definitions provided by the headers which means there are a lot of warnings/errors we're not currently seeing in automated testing (see https://github.com/KhronosGroup/OpenCL-Headers/pull/187 for an example). We should generate tests from the spec XML that use all the definitions provided by the headers.

kpet avatar Nov 30 '21 10:11 kpet

Do you have a feel for what this would look like?

I think we could use each of the enums fairly easily:

void use_all_enums() {
    (void)CL_ENUM_XXX;
    (void)CL_ENUM_YYY;
}

Would we want to declare variables of each of the types?

void use_all_types() {
    cl_type_xxx v0;
    cl_type_yyy v1;
}

Would we want to call of of the APIs?

Gut feeling is that this shouldn't be too bad. I'm already generating tests that call all of the extension APIs for the extension loader I've been working on.

This: https://github.com/bashbaug/opencl-extension-loader/blob/main/scripts/call_all.c.mako

generates: https://github.com/bashbaug/opencl-extension-loader/blob/main/tests/call_all.c

bashbaug avatar Nov 30 '21 18:11 bashbaug