cl22: Reuse test harness code in kernel_image_methods (#211)

Some of the setup functionality is already there in the test harness, so
use that and remove the duplicated code from within the suite.

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
This commit is contained in:
Radek Szymanski
2019-04-24 04:28:15 +01:00
committed by Kévin Petit
parent 8a8ebf29b0
commit 5233855ca8
7 changed files with 58 additions and 175 deletions

View File

@@ -20,9 +20,6 @@
extern bool gDebugTrace, gTestSmallImages, gTestMaxImages;
extern clCommandQueueWrapper queue;
extern clContextWrapper context;
typedef struct image_kernel_data
{
cl_int width;
@@ -50,7 +47,7 @@ static const char *methodTest1DImageKernelPattern =
" outData->expectedChannelOrder = %s;\n"
"}";
static int test_get_1Dimage_info_single( cl_device_id device, image_descriptor *imageInfo, MTdata d )
static int test_get_1Dimage_info_single( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
{
int error = 0;
@@ -147,7 +144,7 @@ static int test_get_1Dimage_info_single( cl_device_id device, image_descriptor *
return error;
}
int test_get_image_info_1D( cl_device_id device, cl_image_format *format )
int test_get_image_info_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
{
size_t maxWidth;
cl_ulong maxAllocSize, memSize;
@@ -177,7 +174,7 @@ int test_get_image_info_1D( cl_device_id device, cl_image_format *format )
if( gDebugTrace )
log_info( " at size %d\n", (int)imageInfo.width );
int ret = test_get_1Dimage_info_single( device, &imageInfo, seed );
int ret = test_get_1Dimage_info_single( context, queue, &imageInfo, seed );
if( ret )
return -1;
}
@@ -198,7 +195,7 @@ int test_get_image_info_1D( cl_device_id device, cl_image_format *format )
log_info( "Testing %d\n", (int)sizes[ idx ][ 0 ]);
if( gDebugTrace )
log_info( " at max size %d\n", (int)sizes[ idx ][ 0 ] );
if( test_get_1Dimage_info_single( device, &imageInfo, seed ) )
if( test_get_1Dimage_info_single( context, queue, &imageInfo, seed ) )
return -1;
}
}
@@ -227,7 +224,7 @@ int test_get_image_info_1D( cl_device_id device, cl_image_format *format )
if( gDebugTrace )
log_info( " at size %d (row pitch %d) out of %d\n", (int)imageInfo.width, (int)imageInfo.rowPitch, (int)maxWidth );
int ret = test_get_1Dimage_info_single( device, &imageInfo, seed );
int ret = test_get_1Dimage_info_single( context, queue, &imageInfo, seed );
if( ret )
return -1;
}