Get rid of test_finish macro and related ATF cruft (#633)

Closes #431

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h
index e85a53f..e14bba4 100644
--- a/test_common/harness/errorHelpers.h
+++ b/test_common/harness/errorHelpers.h
@@ -31,47 +31,29 @@
 #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__)
diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp
index 4fd122f..818e185 100644
--- a/test_common/harness/testHarness.cpp
+++ b/test_common/harness/testHarness.cpp
@@ -139,7 +139,6 @@
     argc = parseCustomParam(argc, argv);
     if (argc == -1)
     {
-        test_finish();
         return EXIT_FAILURE;
     }
 
@@ -164,7 +163,6 @@
         {
             log_info( "\t%s\n", testList[i].name );
         }
-        test_finish();
         return EXIT_SUCCESS;
     }
 
@@ -291,14 +289,12 @@
     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 @@
     err = clGetPlatformIDs(num_platforms, platforms, NULL);
     if (err) {
         print_error(err, "clGetPlatformIDs failed");
-        test_finish();
         return EXIT_FAILURE;
     }
 
@@ -314,14 +309,12 @@
     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 @@
     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 @@
 
     if( printDeviceHeader( device ) != CL_SUCCESS )
     {
-        test_finish();
         return EXIT_FAILURE;
     }
 
@@ -347,7 +338,6 @@
     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 @@
     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 @@
     if (err)
     {
         print_error(err, "clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed\n");
-        test_finish();
         return EXIT_FAILURE;
     }
 
@@ -388,14 +376,12 @@
         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 @@
         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 @@
         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 @@
     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 @@
     else
     {
         log_error("Invalid device address bit size returned by device.\n");
-        test_finish();
         return EXIT_FAILURE;
     }
 
@@ -668,8 +649,6 @@
         }
     }
 
-    test_finish();
-
     free( selectedTestList );
     free( resultTestList );
 
diff --git a/test_conformance/allocations/allocation_functions.cpp b/test_conformance/allocations/allocation_functions.cpp
index 40f8604..7182c72 100644
--- a/test_conformance/allocations/allocation_functions.cpp
+++ b/test_conformance/allocations/allocation_functions.cpp
@@ -275,7 +275,6 @@
     // 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 0de1c50..0dec4c6 100644
--- a/test_conformance/allocations/main.cpp
+++ b/test_conformance/allocations/main.cpp
@@ -277,7 +277,6 @@
     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 9ae38b8..4ed81cc 100644
--- a/test_conformance/basic/test_fpmath_float.cpp
+++ b/test_conformance/basic/test_fpmath_float.cpp
@@ -132,7 +132,6 @@
     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 @@
         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 9c154e5..a964f6a 100644
--- a/test_conformance/basic/test_fpmath_float2.cpp
+++ b/test_conformance/basic/test_fpmath_float2.cpp
@@ -132,7 +132,6 @@
     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 @@
         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 26c1a84..275b4f3 100644
--- a/test_conformance/basic/test_fpmath_float4.cpp
+++ b/test_conformance/basic/test_fpmath_float4.cpp
@@ -132,7 +132,6 @@
     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 @@
         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 3eecb63..831defe 100644
--- a/test_conformance/basic/test_queue_priority.cpp
+++ b/test_conformance/basic/test_queue_priority.cpp
@@ -176,7 +176,6 @@
   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 @@
   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 @@
   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 @@
     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 6853273..7ad348f 100644
--- a/test_conformance/events/test_userevents.cpp
+++ b/test_conformance/events/test_userevents.cpp
@@ -26,26 +26,6 @@
 #include "harness/kernelHelpers.h"
 
 ///////////////////////////////////////////////////////////////////////////////
-// ATF performance framework.
-
-#if USE_ATF
-#include <ATF/ATF.h>
-#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.
 
 #if defined(_MSC_VER)
diff --git a/test_conformance/gl/main.cpp b/test_conformance/gl/main.cpp
index 1320ff7..203e915 100644
--- a/test_conformance/gl/main.cpp
+++ b/test_conformance/gl/main.cpp
@@ -163,7 +163,6 @@
   argc = parseCustomParam(argc, argv);
   if (argc == -1)
   {
-    test_finish ();
     return -1;
   }	
 
@@ -207,7 +206,6 @@
     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 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 @@
     // 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 @@
     if( sCurrentContext == NULL )
       {
         log_error( "ERROR: Unable to obtain CL context from GL\n" );
-        test_finish();
         return -1;
       }
 
@@ -268,19 +262,16 @@
     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 @@
 
     if (numDevices < 1) {
       log_error("No devices found.\n");
-      test_finish();
       return -1;
     }
 
@@ -298,7 +288,6 @@
       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 @@
     // 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 @@
     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 @@
     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 @@
 
     if (numDevices < 1) {
       log_error("No devices found.\n");
-      test_finish();
       return -1;
     }
 
@@ -371,7 +354,6 @@
       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 e3fd05d..37202ce 100644
--- a/test_conformance/gl/test_fence_sync.cpp
+++ b/test_conformance/gl/test_fence_sync.cpp
@@ -669,7 +669,6 @@
     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 fc623dc..d0c12c9 100644
--- a/test_conformance/gles/main.cpp
+++ b/test_conformance/gles/main.cpp
@@ -120,7 +120,6 @@
     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 @@
         {
            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 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 @@
     // 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 @@
     if( sCurrentContext == NULL )
       {
         log_error( "ERROR: Unable to obtain CL context from GL\n" );
-        test_finish();
         error = -1;
         goto cleanup;
       }
@@ -195,7 +189,6 @@
     if( error != CL_SUCCESS )
       {
         print_error( error, "Unable to get device count from context" );
-        test_finish();
         error = -1;
         goto cleanup;
       }
@@ -203,7 +196,6 @@
 
     if (numDevices < 1) {
       log_error("No devices found.\n");
-      test_finish();
       error = -1;
       goto cleanup;
     }
@@ -211,7 +203,6 @@
     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 @@
       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 @@
     // 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 @@
     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 @@
     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 @@
 
     if (numDevices < 1) {
       log_error("No devices found.\n");
-      test_finish();
       error = -1;
       goto cleanup;
     }
@@ -322,7 +308,6 @@
     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 @@
       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 73fd3f9..1af138c 100644
--- a/test_conformance/half/main.cpp
+++ b/test_conformance/half/main.cpp
@@ -95,7 +95,6 @@
     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 7894537..7aedc5b 100644
--- a/test_conformance/images/kernel_image_methods/main.cpp
+++ b/test_conformance/images/kernel_image_methods/main.cpp
@@ -78,7 +78,6 @@
     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 6b5a0d8..6f177a9 100644
--- a/test_conformance/images/kernel_read_write/main.cpp
+++ b/test_conformance/images/kernel_read_write/main.cpp
@@ -280,7 +280,6 @@
     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 ffeaff1..55ef5a0 100644
--- a/test_conformance/math_brute_force/Utility.h
+++ b/test_conformance/math_brute_force/Utility.h
@@ -81,18 +81,7 @@
 #define LOWER_IS_BETTER     0
 #define HIGHER_IS_BETTER    1
 
-#if USE_ATF
-
-    #include <ATF/ATF.h>
-    #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 50eb6b0..0e7e628 100644
--- a/test_conformance/math_brute_force/main.cpp
+++ b/test_conformance/math_brute_force/main.cpp
@@ -133,7 +133,6 @@
 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 @@
     {
         return -1;
     }
-    atexit(TestFinishAtExit);
 
 #if defined( __APPLE__ )
     struct timeval startTime;
@@ -1993,7 +1991,3 @@
     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 7325918..16bb02c 100644
--- a/test_conformance/printf/test_printf.cpp
+++ b/test_conformance/printf/test_printf.cpp
@@ -1033,7 +1033,6 @@
     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 dac69a7..e407c5c 100644
--- a/test_conformance/printf/test_printf.h
+++ b/test_conformance/printf/test_printf.h
@@ -29,21 +29,6 @@
 #include <CL/cl_platform.h>
 #endif
 
-// Enable the test to be used with ATF
-#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 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 e7071b6..518d030 100644
--- a/test_conformance/select/test_select.cpp
+++ b/test_conformance/select/test_select.cpp
@@ -58,8 +58,6 @@
 
 static void printUsage( void );
 
-static void TestFinishAtExit(void);
-
 //-----------------------------------------
 // Definitions and initializations
 //-----------------------------------------
@@ -579,7 +577,6 @@
 int main(int argc, const char* argv[])
 {
     test_start();
-    atexit(TestFinishAtExit);
 
     argc = parseCustomParam(argc, argv);
     if (argc == -1)
@@ -666,7 +663,3 @@
     }
 }
 
-static void TestFinishAtExit(void)
-{
-    test_finish();
-}
diff --git a/test_conformance/select/test_select.h b/test_conformance/select/test_select.h
index 752cd10..c51ae13 100644
--- a/test_conformance/select/test_select.h
+++ b/test_conformance/select/test_select.h
@@ -27,22 +27,6 @@
 #include <CL/opencl.h>
 #endif
 
-// Enable the test to be used with ATF
-#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 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 1a7aa07..71c58bc 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 <stdio.h>
 #include "test_select.h"
diff --git a/test_conformance/vec_step/test_step.cpp b/test_conformance/vec_step/test_step.cpp
index 20dbbef..a2c57c3 100644
--- a/test_conformance/vec_step/test_step.cpp
+++ b/test_conformance/vec_step/test_step.cpp
@@ -59,7 +59,6 @@
     if (err)
     {
         print_error(err, "clGetDeviceInfo for CL_DEVICE_PROFILE failed\n" );
-        test_finish();
         return -1;
     }
     gIsEmbedded = NULL != strstr(profile, "EMBEDDED_PROFILE");