Ensure is_extension_available is used where possible (#721)

(Patch1)
A number of tests have got their own code for checking the presence of
extensions. This change replaces that code with is_extension_available
function.

Contributes to #627

Change-Id: I8dd2233719aa8c84841ac61776437d7f6e3fafe6
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
This commit is contained in:
ellnor01
2020-04-02 21:22:02 +01:00
committed by GitHub
parent aee0a22ad2
commit ef3528e78a
9 changed files with 16 additions and 205 deletions

View File

@@ -394,33 +394,7 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
gInfNanSupport = 0;
// check the extensions list to see if ulong and long are supported
size_t extensionsStringSize = 0;
if( (err = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, 0, NULL, &extensionsStringSize ) ))
{
print_error( err, "Unable to get extensions string size for embedded device" );
return EXIT_FAILURE;
}
char *extensions_string = (char*) malloc(extensionsStringSize);
if( NULL == extensions_string )
{
print_error( CL_OUT_OF_HOST_MEMORY, "Unable to allocate storage for extensions string for embedded device" );
return EXIT_FAILURE;
}
BufferOwningPtr<char> extensions_stringBuf(extensions_string);
if( (err = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, extensionsStringSize, extensions_string, NULL ) ))
{
print_error( err, "Unable to get extensions string for embedded device" );
return EXIT_FAILURE;
}
if( extensions_string[extensionsStringSize-1] != '\0' )
{
log_error( "FAILURE: extensions string for embedded device is not NUL terminated" );
return EXIT_FAILURE;
}
if( NULL == strstr( extensions_string, "cles_khr_int64" ))
if( !is_extension_available(device, "cles_khr_int64" ))
gHasLong = 0;
}