MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / REGISTER_TEST

Function REGISTER_TEST

test_conformance/basic/test_preprocessors.cpp:87–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85 };
86
87REGISTER_TEST(kernel_preprocessor_macros)
88{
89 clProgramWrapper program;
90 clKernelWrapper kernel;
91 clMemWrapper streams[ 3 ];
92
93 int error;
94 size_t threads[] = {1,1,1};
95
96 cl_int results[ 7 ];
97 cl_char fileString[ 512 ] = "", roundingString[ 128 ] = "";
98 char programSource[4096];
99 char curFileName[512];
100 char *programPtr = programSource;
101 snprintf(curFileName, 512, "%s", __FILE__);
102#ifdef _WIN32
103 // Replace "\" with "\\"
104 int i = 0;
105 while(curFileName[i] != '\0') {
106 if (curFileName[i] == '\\') {
107 int j = i + 1;
108 char prev = '\\';
109 while (curFileName[j - 1] != '\0') {
110 char tmp = curFileName[j];
111 curFileName[j] = prev;
112 prev = tmp;
113 j++;
114 }
115 i++;
116 }
117 i++;
118 }
119#endif
120 sprintf(programSource,preprocessor_test,curFileName);
121
122 // Create the kernel
123 if( create_single_kernel_helper( context, &program, &kernel, 1, (const char **)&programPtr, "test" ) != 0 )
124 {
125 return -1;
126 }
127
128 /* Create some I/O streams */
129 streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(results),
130 NULL, &error);
131 test_error( error, "Creating test array failed" );
132 streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(fileString),
133 NULL, &error);
134 test_error( error, "Creating test array failed" );
135 streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE,
136 sizeof(roundingString), NULL, &error);
137 test_error( error, "Creating test array failed" );
138
139 // Set up and run
140 for( int i = 0; i < 3; i++ )
141 {
142 error = clSetKernelArg( kernel, i, sizeof( streams[i] ), &streams[i] );
143 test_error( error, "Unable to set indexed kernel arguments" );
144 }

Callers

nothing calls this directly

Calls 7

checkForImageSupportFunction · 0.85
get_device_cl_versionFunction · 0.85
get_device_cl_c_versionFunction · 0.85
to_uintMethod · 0.80
to_stringMethod · 0.80

Tested by

no test coverage detected