summaryrefslogtreecommitdiff
path: root/utests/compiler_copy_buffer_row.cpp
diff options
context:
space:
mode:
authorBenjamin Segovia <segovia.benjamin@gmail.com>2012-05-03 17:12:18 +0000
committerKeith Packard <keithp@keithp.com>2012-08-10 16:16:59 -0700
commit14430f2092f27a4fda9d8d80be90373388a06801 (patch)
tree5fa0ec1d8cf63d3c8c033d5e389130a0cbaf4851 /utests/compiler_copy_buffer_row.cpp
parentccd746d3af1a4778e5c145fb752ea5a739f70840 (diff)
downloadbeignet-14430f2092f27a4fda9d8d80be90373388a06801.tar.gz
Finished the small test framework
Diffstat (limited to 'utests/compiler_copy_buffer_row.cpp')
-rw-r--r--utests/compiler_copy_buffer_row.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/utests/compiler_copy_buffer_row.cpp b/utests/compiler_copy_buffer_row.cpp
index 308e6e3e..cfaea0e9 100644
--- a/utests/compiler_copy_buffer_row.cpp
+++ b/utests/compiler_copy_buffer_row.cpp
@@ -26,25 +26,21 @@ static void compiler_copy_buffer_row(void)
const int row = 8192;
const int row_n = 2;
const int n = row * row_n;
- int status = 0;
- CALL (cl_test_init, "test_copy_buffer_row.cl", "test_copy_buffer_row", SOURCE);
-
- // Create the input data
+ // Setup kernel and buffers
+ OCL_CREATE_KERNEL("test_copy_buffer_row");
src_buffer = (uint32_t *) malloc(sizeof(uint32_t) * n);
for (int32_t i = 0; i < n; ++i) src_buffer[i] = i;
data_buffer = (int *) malloc(sizeof(int) * 2);
data_buffer[0] = row;
data_buffer[1] = n;
-
- // Allocate all buffers
OCL_CREATE_BUFFER(buf[0], CL_MEM_COPY_HOST_PTR, n * sizeof(uint32_t), src_buffer);
OCL_CREATE_BUFFER(buf[1], 0, n * sizeof(uint32_t), NULL);
OCL_CREATE_BUFFER(buf[2], CL_MEM_COPY_HOST_PTR, 2 * sizeof(uint32_t), data_buffer);
free(src_buffer);
free(data_buffer);
- // Run the code
+ // Run the kernel
OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]);
OCL_SET_ARG(2, sizeof(cl_mem), &buf[2]);
@@ -56,15 +52,8 @@ static void compiler_copy_buffer_row(void)
OCL_MAP_BUFFER(0);
OCL_MAP_BUFFER(1);
for (int32_t i = 0; i < n; ++i)
- assert(((uint32_t*)buf_data[0])[i] == ((uint32_t*)buf_data[1])[i]);
- OCL_UNMAP_BUFFER(0);
- OCL_UNMAP_BUFFER(1);
-error:
- cl_release_buffers();
- cl_report_error(status);
- cl_test_destroy();
-
+ OCL_ASSERT(((uint32_t*)buf_data[0])[i] == ((uint32_t*)buf_data[1])[i]);
}
-UTEST_REGISTER(compiler_copy_buffer_row)
+MAKE_UTEST_FROM_FUNCTION(compiler_copy_buffer_row);