summaryrefslogtreecommitdiff
path: root/utests/compiler_copy_buffer.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.cpp
parentccd746d3af1a4778e5c145fb752ea5a739f70840 (diff)
downloadbeignet-14430f2092f27a4fda9d8d80be90373388a06801.tar.gz
Finished the small test framework
Diffstat (limited to 'utests/compiler_copy_buffer.cpp')
-rw-r--r--utests/compiler_copy_buffer.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/utests/compiler_copy_buffer.cpp b/utests/compiler_copy_buffer.cpp
index 9380ace0..ee1dbf1b 100644
--- a/utests/compiler_copy_buffer.cpp
+++ b/utests/compiler_copy_buffer.cpp
@@ -22,9 +22,9 @@
static void compiler_copy_buffer(void)
{
const size_t n = 8192 * 4;
- int status = 0;
- CALL (cl_test_init, "test_copy_buffer.cl", "test_copy_buffer", SOURCE);
+ // Setup kernel and buffers
+ OCL_CREATE_KERNEL("test_copy_buffer");
buf_data[0] = (uint32_t*) malloc(sizeof(uint32_t) * n);
for (uint32_t i = 0; i < n; ++i) ((uint32_t*)buf_data[0])[i] = i;
OCL_CREATE_BUFFER(buf[0], CL_MEM_COPY_HOST_PTR, n * sizeof(uint32_t), buf_data[0]);
@@ -32,25 +32,19 @@ static void compiler_copy_buffer(void)
free(buf_data[0]);
buf_data[0] = NULL;
+ // Run the kernel
OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]);
-
globals[0] = n;
locals[0] = 16;
OCL_NDRANGE(1);
+ // Check result
OCL_MAP_BUFFER(0);
OCL_MAP_BUFFER(1);
for (uint32_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)
+MAKE_UTEST_FROM_FUNCTION(compiler_copy_buffer);