From 0df882e25734cf16d9cfa924cb1a8081d0b670d3 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Tue, 28 Sep 2010 15:43:10 -0400
Subject: [PATCH] Add test for enqueue_copy_buffer. (Bogdan Opanchuk)

---
 test/test_wrapper.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/test/test_wrapper.py b/test/test_wrapper.py
index b61eb4b9..d55c4d18 100644
--- a/test/test_wrapper.py
+++ b/test/test_wrapper.py
@@ -272,6 +272,23 @@ class TestCL:
 
         assert la.norm(a_result - a) == 0
 
+    @pytools.test.mark_test.opencl
+    def test_copy_buffer(self, ctx_getter):
+        context = ctx_getter()
+
+        queue = cl.CommandQueue(context)
+        mf = cl.mem_flags
+
+        a = numpy.random.rand(50000).astype(numpy.float32)
+        b = numpy.empty_like(a)
+
+        buf1 = cl.Buffer(context, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=a)
+        buf2 = cl.Buffer(context, mf.WRITE_ONLY, b.nbytes)
+
+        cl.enqueue_copy_buffer(queue, buf1, buf2).wait()
+        cl.enqueue_read_buffer(queue, buf2, b).wait()
+
+        assert la.norm(a - b) == 0
 
 
 
-- 
GitLab