mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-23 15:39:03 +00:00
Get rid of test_finish macro and related ATF cruft (#633)
Closes #431 Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
@@ -31,47 +31,29 @@ extern "C" {
|
||||
#define LOWER_IS_BETTER 0
|
||||
#define HIGHER_IS_BETTER 1
|
||||
|
||||
// If USE_ATF is defined, all log_error and log_info calls can be routed to test library
|
||||
// functions as described below. This is helpful for integration into an automated testing
|
||||
// system.
|
||||
#if USE_ATF
|
||||
// export BUILD_WITH_ATF=1
|
||||
#include <ATF/ATF.h>
|
||||
#define test_start() ATFTestStart()
|
||||
#define log_info ATFLogInfo
|
||||
#define log_error ATFLogError
|
||||
#define log_missing_feature ATFLogMissingFeature
|
||||
#define log_perf(_number, _higherBetter, _numType, _format, ...) ATFLogPerformanceNumber(_number, _higherBetter, _numType, _format, ##__VA_ARGS__)
|
||||
#define test_finish() ATFTestFinish()
|
||||
#define vlog_perf(_number, _higherBetter, _numType, _format, ...) ATFLogPerformanceNumber(_number, _higherBetter, _numType, _format,##__VA_ARGS__)
|
||||
#define vlog ATFLogInfo
|
||||
#define vlog_error ATFLogError
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#define test_start()
|
||||
#define log_info printf
|
||||
#define log_error printf
|
||||
#define log_missing_feature printf
|
||||
#define log_perf(_number, _higherBetter, _numType, _format, ...) printf("Performance Number " _format " (in %s, %s): %g\n",##__VA_ARGS__, _numType, \
|
||||
_higherBetter?"higher is better":"lower is better", _number )
|
||||
#define test_finish()
|
||||
#define vlog_perf(_number, _higherBetter, _numType, _format, ...) printf("Performance Number " _format " (in %s, %s): %g\n",##__VA_ARGS__, _numType, \
|
||||
_higherBetter?"higher is better":"lower is better" , _number)
|
||||
#ifdef _WIN32
|
||||
#ifdef __MINGW32__
|
||||
// Use __mingw_printf since it supports "%a" format specifier
|
||||
#define vlog __mingw_printf
|
||||
#define vlog_error __mingw_printf
|
||||
#else
|
||||
// Use home-baked function that treats "%a" as "%f"
|
||||
static int vlog_win32(const char *format, ...);
|
||||
#define vlog vlog_win32
|
||||
#define vlog_error vlog_win32
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#define test_start()
|
||||
#define log_info printf
|
||||
#define log_error printf
|
||||
#define log_missing_feature printf
|
||||
#define log_perf(_number, _higherBetter, _numType, _format, ...) printf("Performance Number " _format " (in %s, %s): %g\n",##__VA_ARGS__, _numType, \
|
||||
_higherBetter?"higher is better":"lower is better", _number )
|
||||
#define vlog_perf(_number, _higherBetter, _numType, _format, ...) printf("Performance Number " _format " (in %s, %s): %g\n",##__VA_ARGS__, _numType, \
|
||||
_higherBetter?"higher is better":"lower is better" , _number)
|
||||
#ifdef _WIN32
|
||||
#ifdef __MINGW32__
|
||||
// Use __mingw_printf since it supports "%a" format specifier
|
||||
#define vlog __mingw_printf
|
||||
#define vlog_error __mingw_printf
|
||||
#else
|
||||
#define vlog_error printf
|
||||
#define vlog printf
|
||||
// Use home-baked function that treats "%a" as "%f"
|
||||
static int vlog_win32(const char *format, ...);
|
||||
#define vlog vlog_win32
|
||||
#define vlog_error vlog_win32
|
||||
#endif
|
||||
#else
|
||||
#define vlog_error printf
|
||||
#define vlog printf
|
||||
#endif
|
||||
|
||||
#define ct_assert(b) ct_assert_i(b, __LINE__)
|
||||
|
||||
@@ -139,7 +139,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
argc = parseCustomParam(argc, argv);
|
||||
if (argc == -1)
|
||||
{
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -164,7 +163,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
{
|
||||
log_info( "\t%s\n", testList[i].name );
|
||||
}
|
||||
test_finish();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -291,14 +289,12 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
err = clGetPlatformIDs(0, NULL, &num_platforms);
|
||||
if (err) {
|
||||
print_error(err, "clGetPlatformIDs failed");
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
platforms = (cl_platform_id *) malloc( num_platforms * sizeof( cl_platform_id ) );
|
||||
if (!platforms || choosen_platform_index >= num_platforms) {
|
||||
log_error( "platform index out of range -- choosen_platform_index (%d) >= num_platforms (%d)\n", choosen_platform_index, num_platforms );
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
BufferOwningPtr<cl_platform_id> platformsBuf(platforms);
|
||||
@@ -306,7 +302,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
err = clGetPlatformIDs(num_platforms, platforms, NULL);
|
||||
if (err) {
|
||||
print_error(err, "clGetPlatformIDs failed");
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -314,14 +309,12 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
err = clGetDeviceIDs(platforms[choosen_platform_index], device_type, 0, NULL, &num_devices );
|
||||
if (err) {
|
||||
print_error(err, "clGetDeviceIDs failed");
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
devices = (cl_device_id *) malloc( num_devices * sizeof( cl_device_id ) );
|
||||
if (!devices || choosen_device_index >= num_devices) {
|
||||
log_error( "device index out of range -- choosen_device_index (%d) >= num_devices (%d)\n", choosen_device_index, num_devices );
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
BufferOwningPtr<cl_device_id> devicesBuf(devices);
|
||||
@@ -331,7 +324,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
err = clGetDeviceIDs(platforms[choosen_platform_index], device_type, num_devices, devices, NULL );
|
||||
if (err) {
|
||||
print_error(err, "clGetDeviceIDs failed");
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -339,7 +331,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
|
||||
if( printDeviceHeader( device ) != CL_SUCCESS )
|
||||
{
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -347,7 +338,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
err = clGetDeviceInfo( device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof( fpconfig ), &fpconfig, NULL );
|
||||
if (err) {
|
||||
print_error(err, "clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed");
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -361,7 +351,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
if (err)
|
||||
{
|
||||
print_error(err, "clGetDeviceInfo for CL_DEVICE_PROFILE failed\n" );
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
gIsEmbedded = NULL != strstr(profile, "EMBEDDED_PROFILE");
|
||||
@@ -372,7 +361,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
if (err)
|
||||
{
|
||||
print_error(err, "clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed\n");
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -388,14 +376,12 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
if( (err = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, 0, NULL, &extensionsStringSize ) ))
|
||||
{
|
||||
print_error( err, "Unable to get extensions string size for embedded device" );
|
||||
test_finish();
|
||||
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" );
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
BufferOwningPtr<char> extensions_stringBuf(extensions_string);
|
||||
@@ -403,14 +389,12 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
if( (err = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, extensionsStringSize, extensions_string, NULL ) ))
|
||||
{
|
||||
print_error( err, "Unable to get extensions string for embedded device" );
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if( extensions_string[extensionsStringSize-1] != '\0' )
|
||||
{
|
||||
log_error( "FAILURE: extensions string for embedded device is not NUL terminated" );
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -427,7 +411,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
if( (err = clGetDeviceInfo( device, CL_DEVICE_OPENCL_C_VERSION, sizeof(c_version), c_version, NULL )) )
|
||||
{
|
||||
log_error( "FAILURE: unable to get CL_DEVICE_OPENCL_C_VERSION on 1.0 device. (%d)\n", err );
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -444,7 +427,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
if( (err = clGetDeviceInfo( device, CL_DEVICE_ADDRESS_BITS, sizeof( device_address_bits ), &device_address_bits, NULL ) ))
|
||||
{
|
||||
print_error( err, "Unable to obtain device address bits" );
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if( device_address_bits )
|
||||
@@ -452,7 +434,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def
|
||||
else
|
||||
{
|
||||
log_error("Invalid device address bit size returned by device.\n");
|
||||
test_finish();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -668,8 +649,6 @@ int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id dev
|
||||
}
|
||||
}
|
||||
|
||||
test_finish();
|
||||
|
||||
free( selectedTestList );
|
||||
free( resultTestList );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user