From b2eba77d424175c74230cad25ce6b7d45c2a7869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Mon, 2 Mar 2020 15:06:44 +0000 Subject: [PATCH] Get rid of test_finish macro and related ATF cruft (#633) Closes #431 Signed-off-by: Kevin Petit --- test_common/harness/errorHelpers.h | 60 +++++++------------ test_common/harness/testHarness.cpp | 21 ------- .../allocations/allocation_functions.cpp | 1 - test_conformance/allocations/main.cpp | 1 - test_conformance/basic/test_fpmath_float.cpp | 3 - test_conformance/basic/test_fpmath_float2.cpp | 3 - test_conformance/basic/test_fpmath_float4.cpp | 3 - .../basic/test_queue_priority.cpp | 5 -- test_conformance/events/test_userevents.cpp | 20 ------- test_conformance/gl/main.cpp | 18 ------ test_conformance/gl/test_fence_sync.cpp | 1 - test_conformance/gles/main.cpp | 17 ------ test_conformance/half/main.cpp | 1 - .../images/kernel_image_methods/main.cpp | 1 - .../images/kernel_read_write/main.cpp | 1 - test_conformance/math_brute_force/Utility.h | 13 +--- test_conformance/math_brute_force/main.cpp | 6 -- test_conformance/printf/test_printf.cpp | 1 - test_conformance/printf/test_printf.h | 15 ----- test_conformance/select/test_select.cpp | 7 --- test_conformance/select/test_select.h | 16 ----- test_conformance/select/util_select.cpp | 1 + test_conformance/vec_step/test_step.cpp | 1 - 23 files changed, 23 insertions(+), 193 deletions(-) diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h index e85a53fe..e14bba47 100644 --- a/test_common/harness/errorHelpers.h +++ b/test_common/harness/errorHelpers.h @@ -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 - #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 - #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 +#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__) diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index 4fd122f9..818e1853 100644 --- a/test_common/harness/testHarness.cpp +++ b/test_common/harness/testHarness.cpp @@ -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 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 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 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 ); diff --git a/test_conformance/allocations/allocation_functions.cpp b/test_conformance/allocations/allocation_functions.cpp index 40f8604c..7182c727 100644 --- a/test_conformance/allocations/allocation_functions.cpp +++ b/test_conformance/allocations/allocation_functions.cpp @@ -275,7 +275,6 @@ int allocate_size(cl_context context, cl_command_queue *queue, cl_device_id devi // Otherwise we succeeded if (result != SUCCEEDED) { log_error("Test logic error."); - test_finish(); exit(-1); } amount_allocated += allocation_this_time; diff --git a/test_conformance/allocations/main.cpp b/test_conformance/allocations/main.cpp index 0de1c509..0dec4c6d 100644 --- a/test_conformance/allocations/main.cpp +++ b/test_conformance/allocations/main.cpp @@ -277,7 +277,6 @@ int main(int argc, const char *argv[]) argc = parseCustomParam(argc, argv); if (argc == -1) { - test_finish(); return 1; } diff --git a/test_conformance/basic/test_fpmath_float.cpp b/test_conformance/basic/test_fpmath_float.cpp index 9ae38b82..4ed81cc7 100644 --- a/test_conformance/basic/test_fpmath_float.cpp +++ b/test_conformance/basic/test_fpmath_float.cpp @@ -132,7 +132,6 @@ test_fpmath_float(cl_device_id device, cl_context context, cl_command_queue queu err = clGetDeviceInfo( device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof( single_config ), &single_config, NULL ); if (err) { log_error("clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed: %d", err); - test_finish(); return -1; } //If we only support rtz mode @@ -144,13 +143,11 @@ test_fpmath_float(cl_device_id device, cl_context context, cl_command_queue queu if( err ) { log_error("clGetDeviceInfo for CL_DEVICE_PROFILE failed: %d", err); - test_finish(); return -1; } if( 0 != strcmp( profile, "EMBEDDED_PROFILE")) { log_error( "FAILURE: Device doesn't support CL_FP_ROUND_TO_NEAREST and isn't EMBEDDED_PROFILE\n" ); - test_finish(); return -1; } diff --git a/test_conformance/basic/test_fpmath_float2.cpp b/test_conformance/basic/test_fpmath_float2.cpp index 9c154e59..a964f6a4 100644 --- a/test_conformance/basic/test_fpmath_float2.cpp +++ b/test_conformance/basic/test_fpmath_float2.cpp @@ -132,7 +132,6 @@ test_fpmath_float2(cl_device_id device, cl_context context, cl_command_queue que err = clGetDeviceInfo( device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof( single_config ), &single_config, NULL ); if (err) { log_error("clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed: %d", err); - test_finish(); return -1; } //If we only support rtz mode @@ -144,13 +143,11 @@ test_fpmath_float2(cl_device_id device, cl_context context, cl_command_queue que if( err ) { log_error("clGetDeviceInfo for CL_DEVICE_PROFILE failed: %d", err); - test_finish(); return -1; } if( 0 != strcmp( profile, "EMBEDDED_PROFILE")) { log_error( "FAILURE: Device doesn't support CL_FP_ROUND_TO_NEAREST and isn't EMBEDDED_PROFILE\n" ); - test_finish(); return -1; } diff --git a/test_conformance/basic/test_fpmath_float4.cpp b/test_conformance/basic/test_fpmath_float4.cpp index 26c1a849..275b4f37 100644 --- a/test_conformance/basic/test_fpmath_float4.cpp +++ b/test_conformance/basic/test_fpmath_float4.cpp @@ -132,7 +132,6 @@ test_fpmath_float4(cl_device_id device, cl_context context, cl_command_queue que err = clGetDeviceInfo( device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof( single_config ), &single_config, NULL ); if (err) { log_error("clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed: %d", err); - test_finish(); return -1; } //If we only support rtz mode @@ -144,13 +143,11 @@ test_fpmath_float4(cl_device_id device, cl_context context, cl_command_queue que if( err ) { log_error("clGetDeviceInfo for CL_DEVICE_PROFILE failed: %d", err); - test_finish(); return -1; } if( 0 != strcmp( profile, "EMBEDDED_PROFILE")) { log_error( "FAILURE: Device doesn't support CL_FP_ROUND_TO_NEAREST and isn't EMBEDDED_PROFILE\n" ); - test_finish(); return -1; } diff --git a/test_conformance/basic/test_queue_priority.cpp b/test_conformance/basic/test_queue_priority.cpp index 3eecb63f..831defe7 100644 --- a/test_conformance/basic/test_queue_priority.cpp +++ b/test_conformance/basic/test_queue_priority.cpp @@ -176,7 +176,6 @@ int test_queue_priority(cl_device_id device, cl_context context, cl_command_queu err = clGetDeviceInfo( device, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof( num_compute_units ), &num_compute_units, NULL ); if (err) { log_error("clGetDeviceInfo for CL_DEVICE_MAX_COMPUTE_UNITS failed: %d", err); - test_finish(); return -1; } @@ -191,7 +190,6 @@ int test_queue_priority(cl_device_id device, cl_context context, cl_command_queu cl_command_queue background_queue = clCreateCommandQueueWithProperties(context, device, queue_properties, &err); if (err) { log_error("clCreateCommandQueueWithPropertiesAPPLE failed: %d", err); - test_finish(); return -1; } @@ -214,7 +212,6 @@ int test_queue_priority(cl_device_id device, cl_context context, cl_command_queu err = clGetDeviceInfo( device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof( single_config ), &single_config, NULL ); if (err) { log_error("clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed: %d", err); - test_finish(); return -1; } //If we only support rtz mode @@ -226,13 +223,11 @@ int test_queue_priority(cl_device_id device, cl_context context, cl_command_queu if( err ) { log_error("clGetDeviceInfo for CL_DEVICE_PROFILE failed: %d", err); - test_finish(); return -1; } if( 0 != strcmp( profile, "EMBEDDED_PROFILE")) { log_error( "FAILURE: Device doesn't support CL_FP_ROUND_TO_NEAREST and isn't EMBEDDED_PROFILE\n" ); - test_finish(); return -1; } diff --git a/test_conformance/events/test_userevents.cpp b/test_conformance/events/test_userevents.cpp index 6853273d..7ad348fa 100644 --- a/test_conformance/events/test_userevents.cpp +++ b/test_conformance/events/test_userevents.cpp @@ -25,26 +25,6 @@ #include #include "harness/kernelHelpers.h" -/////////////////////////////////////////////////////////////////////////////// -// ATF performance framework. - -#if USE_ATF -#include -#define test_start() ATFTestStart() -#define log_perf(_number, _higherBetter, _numType, _format, ...) ATFLogPerformanceNumber(_number, _higherBetter, _numType, _format,##__VA_ARGS__) -#define log_info ATFLogInfo -#define log_error ATFLogError -#define log_no_atf -#define test_finish() ATFTestFinish() -#else -#define test_start() -#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 log_info(...) fprintf(stdout, ## __VA_ARGS__ ) -#define log_error(...) fprintf(stderr, ## __VA_ARGS__ ) -#define log_info_no_atf(...) log_info(## __VA_ARGS__ ) -#define test_finish() -#endif - /////////////////////////////////////////////////////////////////////////////// // CL error checking. diff --git a/test_conformance/gl/main.cpp b/test_conformance/gl/main.cpp index 1320ff76..203e915e 100644 --- a/test_conformance/gl/main.cpp +++ b/test_conformance/gl/main.cpp @@ -163,7 +163,6 @@ int main(int argc, const char *argv[]) argc = parseCustomParam(argc, argv); if (argc == -1) { - test_finish (); return -1; } @@ -207,7 +206,6 @@ int main(int argc, const char *argv[]) log_info( "Note: Any 3.2 test names must follow 2.1 test names on the command line.\n" ); log_info( "Use environment variables to specify desired device.\n" ); - test_finish(); return 0; } @@ -228,11 +226,9 @@ int main(int argc, const char *argv[]) int supported = glEnv->SupportsCLGLInterop( requestedDeviceType ); if( supported == 0 ) { log_info("Test not run because GL-CL interop is not supported for any devices of the requested type.\n"); - test_finish(); return 0; } else if ( supported == -1 ) { log_error("Unable to setup the test or failed to determine if CL-GL interop is supported.\n"); - test_finish(); return -1; } @@ -248,7 +244,6 @@ int main(int argc, const char *argv[]) // At least one device supports CL-GL interop, so init the test. if( glEnv->Init( &argc, (char **)argv, CL_FALSE ) ) { log_error("Failed to initialize the GL environment for this test.\n"); - test_finish(); return -1; } @@ -257,7 +252,6 @@ int main(int argc, const char *argv[]) if( sCurrentContext == NULL ) { log_error( "ERROR: Unable to obtain CL context from GL\n" ); - test_finish(); return -1; } @@ -268,19 +262,16 @@ int main(int argc, const char *argv[]) if( error != CL_SUCCESS ) { print_error( error, "Unable to get device count from context" ); - test_finish(); return -1; } deviceIDs = (cl_device_id *)malloc(numDevices); if (deviceIDs == NULL) { print_error( error, "malloc failed" ); - test_finish(); return -1; } error = clGetContextInfo( sCurrentContext, CL_CONTEXT_DEVICES, numDevices, deviceIDs, NULL); if( error != CL_SUCCESS ) { print_error( error, "Unable to get device list from context" ); - test_finish(); return -1; } @@ -288,7 +279,6 @@ int main(int argc, const char *argv[]) if (numDevices < 1) { log_error("No devices found.\n"); - test_finish(); return -1; } @@ -298,7 +288,6 @@ int main(int argc, const char *argv[]) for( size_t i = 0; i < numDevices; i++ ) { log_info( "\nTesting OpenGL 2.x\n" ); if( printDeviceHeader( deviceIDs[ i ] ) != CL_SUCCESS ) { - test_finish(); return -1; } @@ -322,7 +311,6 @@ int main(int argc, const char *argv[]) // At least one device supports CL-GL interop, so init the test. if( glEnv->Init( &argc, (char **)argv, CL_TRUE ) ) { log_error("Failed to initialize the GL environment for this test.\n"); - test_finish(); return -1; } @@ -330,7 +318,6 @@ int main(int argc, const char *argv[]) sCurrentContext = glEnv->CreateCLContext(); if( sCurrentContext == NULL ) { log_error( "ERROR: Unable to obtain CL context from GL\n" ); - test_finish(); return -1; } @@ -340,19 +327,16 @@ int main(int argc, const char *argv[]) error = clGetContextInfo( sCurrentContext, CL_CONTEXT_DEVICES, 0, NULL, &numDevices); if( error != CL_SUCCESS ) { print_error( error, "Unable to get device count from context" ); - test_finish(); return -1; } deviceIDs = (cl_device_id *)malloc(numDevices); if (deviceIDs == NULL) { print_error( error, "malloc failed" ); - test_finish(); return -1; } error = clGetContextInfo( sCurrentContext, CL_CONTEXT_DEVICES, numDevices, deviceIDs, NULL); if( error != CL_SUCCESS ) { print_error( error, "Unable to get device list from context" ); - test_finish(); return -1; } @@ -360,7 +344,6 @@ int main(int argc, const char *argv[]) if (numDevices < 1) { log_error("No devices found.\n"); - test_finish(); return -1; } @@ -371,7 +354,6 @@ int main(int argc, const char *argv[]) for( size_t i = 0; i < numDevices; i++ ) { log_info( "\nTesting OpenGL 3.2\n" ); if( printDeviceHeader( deviceIDs[ i ] ) != CL_SUCCESS ) { - test_finish(); return -1; } diff --git a/test_conformance/gl/test_fence_sync.cpp b/test_conformance/gl/test_fence_sync.cpp index e3fd05d6..37202cef 100644 --- a/test_conformance/gl/test_fence_sync.cpp +++ b/test_conformance/gl/test_fence_sync.cpp @@ -669,7 +669,6 @@ int test_fence_sync( cl_device_id device, cl_context context, cl_command_queue q if( err != CL_SUCCESS ) { print_error( err, "Unable to get device count from context" ); - test_finish(); return -1; } vs_count = (GLint)device_cb / sizeof(cl_device_id); diff --git a/test_conformance/gles/main.cpp b/test_conformance/gles/main.cpp index fc623dcb..d0c12c91 100644 --- a/test_conformance/gles/main.cpp +++ b/test_conformance/gles/main.cpp @@ -120,7 +120,6 @@ int main(int argc, const char *argv[]) log_info( "Note: Any 3.2 test names must follow 2.1 test names on the command line." ); log_info( "Use environment variables to specify desired device." ); - test_finish(); return 0; } @@ -135,7 +134,6 @@ int main(int argc, const char *argv[]) { printf("Requested device type is CL_DEVICE_TYPE_CPU\n"); log_info("Invalid CL device type. GL tests can only run on a GPU device.\n"); - test_finish(); return 0; } }//for @@ -157,12 +155,10 @@ int main(int argc, const char *argv[]) int supported = glEnv->SupportsCLGLInterop( requestedDeviceType ); if( supported == 0 ) { log_info("Test not run because GL-CL interop is not supported for any devices of the requested type.\n"); - test_finish(); error = 0; goto cleanup; } else if ( supported == -1 ) { log_error("Failed to determine if CL-GL interop is supported.\n"); - test_finish(); error = -1; goto cleanup; } @@ -173,7 +169,6 @@ int main(int argc, const char *argv[]) // At least one device supports CL-GL interop, so init the test. if( glEnv->Init( &argc, (char **)argv, CL_FALSE ) ) { log_error("Failed to initialize the GL environment for this test.\n"); - test_finish(); error = -1; goto cleanup; } @@ -183,7 +178,6 @@ int main(int argc, const char *argv[]) if( sCurrentContext == NULL ) { log_error( "ERROR: Unable to obtain CL context from GL\n" ); - test_finish(); error = -1; goto cleanup; } @@ -195,7 +189,6 @@ int main(int argc, const char *argv[]) if( error != CL_SUCCESS ) { print_error( error, "Unable to get device count from context" ); - test_finish(); error = -1; goto cleanup; } @@ -203,7 +196,6 @@ int main(int argc, const char *argv[]) if (numDevices < 1) { log_error("No devices found.\n"); - test_finish(); error = -1; goto cleanup; } @@ -211,7 +203,6 @@ int main(int argc, const char *argv[]) error = clGetContextInfo( sCurrentContext, CL_CONTEXT_DEVICES, sizeof( deviceIDs ), deviceIDs, NULL); if( error != CL_SUCCESS ) { print_error( error, "Unable to get device list from context" ); - test_finish(); error = -1; goto cleanup; } @@ -222,7 +213,6 @@ int main(int argc, const char *argv[]) for( size_t i = 0; i < numDevices; i++ ) { log_info( "\nTesting OpenGL 2.x\n" ); if( printDeviceHeader( deviceIDs[ i ] ) != CL_SUCCESS ) { - test_finish(); error = -1; goto cleanup; } @@ -286,7 +276,6 @@ int main(int argc, const char *argv[]) // At least one device supports CL-GL interop, so init the test. if( glEnv->Init( &argc, (char **)argv, CL_TRUE ) ) { log_error("Failed to initialize the GL environment for this test.\n"); - test_finish(); error = -1; goto cleanup; } @@ -295,7 +284,6 @@ int main(int argc, const char *argv[]) sCurrentContext = glEnv->CreateCLContext(); if( sCurrentContext == NULL ) { log_error( "ERROR: Unable to obtain CL context from GL\n" ); - test_finish(); error = -1; goto cleanup; } @@ -306,7 +294,6 @@ int main(int argc, const char *argv[]) error = clGetContextInfo( sCurrentContext, CL_CONTEXT_DEVICES, 0, NULL, &numDevices); if( error != CL_SUCCESS ) { print_error( error, "Unable to get device count from context" ); - test_finish(); error = -1; goto cleanup; } @@ -314,7 +301,6 @@ int main(int argc, const char *argv[]) if (numDevices < 1) { log_error("No devices found.\n"); - test_finish(); error = -1; goto cleanup; } @@ -322,7 +308,6 @@ int main(int argc, const char *argv[]) error = clGetContextInfo( sCurrentContext, CL_CONTEXT_DEVICES, sizeof( deviceIDs ), deviceIDs, NULL); if( error != CL_SUCCESS ) { print_error( error, "Unable to get device list from context" ); - test_finish(); error = -1; goto cleanup; } @@ -334,13 +319,11 @@ int main(int argc, const char *argv[]) for( size_t i = 0; i < numDevices; i++ ) { log_info( "\nTesting OpenGL 3.2\n" ); if( printDeviceHeader( deviceIDs[ i ] ) != CL_SUCCESS ) { - test_finish(); error = -1; goto cleanup; } #ifdef GL_ES_VERSION_2_0 log_info("Cannot test OpenGL 3.2! This test was built for OpenGL ES 2.0\n"); - test_finish(); error = -1; goto cleanup; #else diff --git a/test_conformance/half/main.cpp b/test_conformance/half/main.cpp index 73fd3f9c..1af138ca 100644 --- a/test_conformance/half/main.cpp +++ b/test_conformance/half/main.cpp @@ -95,7 +95,6 @@ int main (int argc, const char **argv ) argc = parseCustomParam(argc, argv); if (argc == -1) { - test_finish(); return -1; } diff --git a/test_conformance/images/kernel_image_methods/main.cpp b/test_conformance/images/kernel_image_methods/main.cpp index 7894537e..7aedc5bf 100644 --- a/test_conformance/images/kernel_image_methods/main.cpp +++ b/test_conformance/images/kernel_image_methods/main.cpp @@ -78,7 +78,6 @@ int main(int argc, const char *argv[]) argc = parseCustomParam(argc, argv); if (argc == -1) { - test_finish(); return -1; } diff --git a/test_conformance/images/kernel_read_write/main.cpp b/test_conformance/images/kernel_read_write/main.cpp index 6b5a0d81..6f177a98 100644 --- a/test_conformance/images/kernel_read_write/main.cpp +++ b/test_conformance/images/kernel_read_write/main.cpp @@ -280,7 +280,6 @@ int main(int argc, const char *argv[]) argc = parseCustomParam(argc, argv); if (argc == -1) { - test_finish(); return -1; } diff --git a/test_conformance/math_brute_force/Utility.h b/test_conformance/math_brute_force/Utility.h index ffeaff1d..55ef5a09 100644 --- a/test_conformance/math_brute_force/Utility.h +++ b/test_conformance/math_brute_force/Utility.h @@ -81,18 +81,7 @@ extern cl_device_fp_config gDoubleCapabilities; #define LOWER_IS_BETTER 0 #define HIGHER_IS_BETTER 1 -#if USE_ATF - - #include - #define test_start() ATFTestStart() - #define test_finish() ATFTestFinish() - #define vlog( ... ) ATFLogInfo(__VA_ARGS__) - #define vlog_error( ... ) ATFLogError(__VA_ARGS__) - #define vlog_perf( _number, _higherIsBetter, _units, _nameFmt, ... ) ATFLogPerformanceNumber(_number, _higherIsBetter, _units, _nameFmt, __VA_ARGS__ ) - -#else - #include "harness/errorHelpers.h" -#endif +#include "harness/errorHelpers.h" #if defined (_MSC_VER ) //Deal with missing scalbn on windows diff --git a/test_conformance/math_brute_force/main.cpp b/test_conformance/math_brute_force/main.cpp index 50eb6b01..0e7e6289 100644 --- a/test_conformance/math_brute_force/main.cpp +++ b/test_conformance/math_brute_force/main.cpp @@ -133,7 +133,6 @@ static void ReleaseCL( void ); static int InitILogbConstants( void ); static int IsTininessDetectedBeforeRounding( void ); static int IsInRTZMode( void ); //expensive. Please check gIsInRTZMode global instead. -static void TestFinishAtExit(void); int doTest( const char* name ) @@ -816,7 +815,6 @@ int main (int argc, const char * argv[]) { return -1; } - atexit(TestFinishAtExit); #if defined( __APPLE__ ) struct timeval startTime; @@ -1993,7 +1991,3 @@ cl_uint RoundUpToNextPowerOfTwo( cl_uint x ) return x+x; } -void TestFinishAtExit(void) { - test_finish(); -} - diff --git a/test_conformance/printf/test_printf.cpp b/test_conformance/printf/test_printf.cpp index 7325918c..16bb02c8 100644 --- a/test_conformance/printf/test_printf.cpp +++ b/test_conformance/printf/test_printf.cpp @@ -1033,7 +1033,6 @@ test_status InitCL( cl_device_id device ) err = check_opencl_version(device,1,2); if( err != CL_SUCCESS ) { print_missing_feature(err,"printf"); - test_finish(); return TEST_FAIL; } diff --git a/test_conformance/printf/test_printf.h b/test_conformance/printf/test_printf.h index dac69a7c..e407c5cc 100644 --- a/test_conformance/printf/test_printf.h +++ b/test_conformance/printf/test_printf.h @@ -29,21 +29,6 @@ #include #endif -// Enable the test to be used with ATF -#if USE_ATF -// export BUILD_WITH_ATF=1 -#include -#define test_start() ATFTestStart() -#define log_info ATFLogInfo -#define log_error ATFLogError -#define test_finish() ATFTestFinish() -#else -#define test_start() -#define log_info printf -#define log_error printf -#define test_finish() -#endif // USE_ATF - #define ANALYSIS_BUFFER_SIZE 256 //----------------------------------------- diff --git a/test_conformance/select/test_select.cpp b/test_conformance/select/test_select.cpp index e7071b67..518d030f 100644 --- a/test_conformance/select/test_select.cpp +++ b/test_conformance/select/test_select.cpp @@ -58,8 +58,6 @@ static int doTest(cl_command_queue queue, cl_context context, static void printUsage( void ); -static void TestFinishAtExit(void); - //----------------------------------------- // Definitions and initializations //----------------------------------------- @@ -579,7 +577,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char* argv[]) { test_start(); - atexit(TestFinishAtExit); argc = parseCustomParam(argc, argv); if (argc == -1) @@ -666,7 +663,3 @@ static void printUsage( void ) } } -static void TestFinishAtExit(void) -{ - test_finish(); -} diff --git a/test_conformance/select/test_select.h b/test_conformance/select/test_select.h index 752cd10c..c51ae13c 100644 --- a/test_conformance/select/test_select.h +++ b/test_conformance/select/test_select.h @@ -27,22 +27,6 @@ #include #endif -// Enable the test to be used with ATF -#if USE_ATF -// export BUILD_WITH_ATF=1 -#include -#define test_start() ATFTestStart() -#define log_info ATFLogInfo -#define log_error ATFLogError -#define test_finish() ATFTestFinish() -#else -#define test_start() -#define log_info printf -#define log_error printf -#define test_finish() -#endif // USE_ATF - - // Defines the set of types we support (no support for double) typedef enum { kuchar = 0, diff --git a/test_conformance/select/util_select.cpp b/test_conformance/select/util_select.cpp index 1a7aa07a..71c58bc2 100644 --- a/test_conformance/select/util_select.cpp +++ b/test_conformance/select/util_select.cpp @@ -14,6 +14,7 @@ // limitations under the License. // #include "harness/compat.h" +#include "harness/errorHelpers.h" #include #include "test_select.h" diff --git a/test_conformance/vec_step/test_step.cpp b/test_conformance/vec_step/test_step.cpp index 20dbbef3..a2c57c39 100644 --- a/test_conformance/vec_step/test_step.cpp +++ b/test_conformance/vec_step/test_step.cpp @@ -59,7 +59,6 @@ int test_step_internal(cl_device_id deviceID, cl_context context, cl_command_que if (err) { print_error(err, "clGetDeviceInfo for CL_DEVICE_PROFILE failed\n" ); - test_finish(); return -1; } gIsEmbedded = NULL != strstr(profile, "EMBEDDED_PROFILE");