1 // 2 // Copyright (c) 2017 The Khronos Group Inc. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 #ifndef _testBase_h 17 #define _testBase_h 18 19 #include "harness/compat.h" 20 #include <stdio.h> 21 #include <stdlib.h> 22 #include <string.h> 23 24 #include <sys/types.h> 25 #include <sys/stat.h> 26 27 #if !defined(_WIN32) 28 #include <unistd.h> 29 #endif 30 31 #include "harness/errorHelpers.h" 32 #include "harness/kernelHelpers.h" 33 #include "harness/typeWrappers.h" 34 #include "harness/testHarness.h" 35 36 37 #define MAX_NUMBER_TO_ALLOCATE 100 38 39 #define FAILED_CORRUPTED_QUEUE -2 40 #define FAILED_ABORT -1 41 #define FAILED_TOO_BIG 1 42 // On Windows macro `SUCCEEDED' is defined in `WinError.h'. It causes compiler warnings. Let us avoid them. 43 #if defined( _WIN32 ) && defined( SUCCEEDED ) 44 #undef SUCCEEDED 45 #endif 46 #define SUCCEEDED 0 47 48 enum AllocType 49 { 50 BUFFER, 51 IMAGE_READ, 52 IMAGE_WRITE, 53 BUFFER_NON_BLOCKING, 54 IMAGE_READ_NON_BLOCKING, 55 IMAGE_WRITE_NON_BLOCKING, 56 }; 57 58 #define test_error_abort(errCode,msg) test_error_ret_abort(errCode,msg,errCode) 59 #define test_error_ret_abort(errCode,msg,retValue) { if( errCode != CL_SUCCESS ) { print_error( errCode, msg ); return FAILED_ABORT ; } } 60 61 62 #endif // _testBase_h 63 64 65 66