mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Minor refactoring of CL_PROGRAM_SOURCE tests (#1032)
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
This commit is contained in:
@@ -428,7 +428,8 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman
|
||||
int error;
|
||||
char buffer[10240];
|
||||
size_t length;
|
||||
|
||||
size_t line_length = strlen(sample_kernel_code_single_line[0]);
|
||||
bool online_compilation = (gCompilationMode == kOnline);
|
||||
|
||||
error = create_single_kernel_helper_create_program(context, &program, 1, sample_kernel_code_single_line);
|
||||
if( program == NULL )
|
||||
@@ -440,7 +441,7 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman
|
||||
/* Try getting the length */
|
||||
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, 0, NULL, &length );
|
||||
test_error( error, "Unable to get program source length" );
|
||||
if (length != strlen(sample_kernel_code_single_line[0]) + 1 && gCompilationMode == kOnline)
|
||||
if (length != line_length + 1 && online_compilation)
|
||||
{
|
||||
log_error( "ERROR: Length returned for program source is incorrect!\n" );
|
||||
return -1;
|
||||
@@ -449,7 +450,7 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman
|
||||
/* Try normal source */
|
||||
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, sizeof( buffer ), buffer, NULL );
|
||||
test_error( error, "Unable to get program source" );
|
||||
if (strlen(buffer) != strlen(sample_kernel_code_single_line[0]) && gCompilationMode == kOnline)
|
||||
if (strlen(buffer) != line_length && online_compilation)
|
||||
{
|
||||
log_error( "ERROR: Length of program source is incorrect!\n" );
|
||||
return -1;
|
||||
@@ -458,12 +459,12 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman
|
||||
/* Try both at once */
|
||||
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, sizeof( buffer ), buffer, &length );
|
||||
test_error( error, "Unable to get program source" );
|
||||
if (strlen(buffer) != strlen(sample_kernel_code_single_line[0]) && gCompilationMode == kOnline)
|
||||
if (strlen(buffer) != line_length && online_compilation)
|
||||
{
|
||||
log_error( "ERROR: Length of program source is incorrect!\n" );
|
||||
return -1;
|
||||
}
|
||||
if (length != strlen(sample_kernel_code_single_line[0]) + 1 && gCompilationMode == kOnline)
|
||||
if (length != line_length + 1 && online_compilation)
|
||||
{
|
||||
log_error( "ERROR: Returned length of program source is incorrect!\n" );
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user