Re: [Piglit] [PATCH v5] cl: add clEnqueue-read_write BufferRect releated tests

2015-08-18 Thread Serge Martin (EdB)
Hello

I was about to push it, be find that some of the errors tests return CL_SUCCESS 
when they shouldn't have, sorry about that.
Does this test pass on INTEL OCL?

See comments below

On Monday 03 August 2015 01:59:44 Meng Mengmeng wrote:
 It's a simple function test for clEnqueueReadBufferRect and
 clEnqueueWriteBufferRect.
 ---
  tests/cl.py   |   2 +
  tests/cl/api/CMakeLists.cl.txt|   1 +
  tests/cl/api/enqueue-read_write-buffer-rect.c | 338
 ++ 3 files changed, 341 insertions(+)
  create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c
 
 diff --git a/tests/cl.py b/tests/cl.py
 index 4668ddc..572ccdc 100644
 --- a/tests/cl.py
 +++ b/tests/cl.py
 @@ -58,6 +58,8 @@ with profile.group_manager(PiglitCLTest, 'api') as g:
  g(['cl-api-enqueue-copy-buffer-rect'], 'clEnqueueCopyBufferRect')
  g(['cl-api-enqueue-read_write-buffer'],
'clEnqueueReadBuffer and clEnqueueWriteBuffer')
 +g(['cl-api-enqueue-read_write-buffer-rect'],
 +  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
  g(['cl-api-get-mem-object-info'], 'clGetMemObjectInfo')
  g(['cl-api-get-image-info'], 'clGetImageInfo')
  g(['cl-api-retain_release-mem-object'],
 diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
 index b598528..f0a388f 100644
 --- a/tests/cl/api/CMakeLists.cl.txt
 +++ b/tests/cl/api/CMakeLists.cl.txt
 @@ -21,6 +21,7 @@ piglit_cl_add_api_test (enqueue-copy-buffer
 enqueue-copy-buffer.c) piglit_cl_add_api_test (enqueue-map-buffer
 enqueue-map-buffer.c)
  piglit_cl_add_api_test (enqueue-copy-buffer-rect
 enqueue-copy-buffer-rect.c) piglit_cl_add_api_test
 (enqueue-read_write-buffer enqueue-read_write-buffer.c)
 +piglit_cl_add_api_test (enqueue-read_write-buffer-rect
 enqueue-read_write-buffer-rect.c) piglit_cl_add_api_test
 (retain_release-mem-object retain_release-mem-object.c)
 piglit_cl_add_api_test (get-mem-object-info get-mem-object-info.c)
 piglit_cl_add_api_test (get-image-info get-image-info.c)
 diff --git a/tests/cl/api/enqueue-read_write-buffer-rect.c
 b/tests/cl/api/enqueue-read_write-buffer-rect.c new file mode 100644
 index 000..6f7d2ca
 --- /dev/null
 +++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
 @@ -0,0 +1,338 @@
 +/*
 + * Copyright © 2015 Intel Corporation
 + *
 + * Permission is hereby granted, free of charge, to any person obtaining a
 + * copy of this software and associated documentation files (the
 Software), + * to deal in the Software without restriction, including
 without limitation + * the rights to use, copy, modify, merge, publish,
 distribute, sublicense, + * and/or sell copies of the Software, and to
 permit persons to whom the + * Software is furnished to do so, subject to
 the following conditions: + *
 + * The above copyright notice and this permission notice (including the
 next + * paragraph) shall be included in all copies or substantial portions
 of the + * Software.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS
 OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE.
 + *
 + * Authors: Meng Mengmeng mengmeng.meng at intel.com
 + *
 + */
 +
 +#include piglit-framework-cl-api.h
 +#include piglit-util-cl.h
 +
 +
 +PIGLIT_CL_API_TEST_CONFIG_BEGIN
 +
 + config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
 + config.version_min = 11;
 +
 + config.run_per_platform = true;
 + config.create_context = true;
 +
 +PIGLIT_CL_API_TEST_CONFIG_END
 +
 +static bool
 +test_read_rect(cl_command_queue command_queue,
 +   cl_mem buffer,
 +   cl_bool blocking_read,
 +   const size_t * buffer_origin,
 +   const size_t * host_origin,
 +   const size_t * region,
 +   size_t buffer_row_pitch,
 +   size_t buffer_slice_pitch,
 +   size_t host_row_pitch,
 +   size_t host_slice_pitch,
 +   void *ptr,
 +   cl_uint num_events_in_wait_list,
 +   const cl_event *event_wait_list,
 +   cl_event *event,
 +   cl_int expected_error,
 +   enum piglit_result* result,
 +   const char* test_str) {
 + cl_int errNo;
 +
 + errNo = clEnqueueReadBufferRect(command_queue,
 + buffer,
 + blocking_read,
 + buffer_origin,
 + host_origin,
 + region,
 + 

[Piglit] [PATCH v5] cl: add clEnqueue-read_write BufferRect releated tests

2015-08-03 Thread Meng Mengmeng
It's a simple function test for clEnqueueReadBufferRect and
clEnqueueWriteBufferRect.
---
 tests/cl.py   |   2 +
 tests/cl/api/CMakeLists.cl.txt|   1 +
 tests/cl/api/enqueue-read_write-buffer-rect.c | 338 ++
 3 files changed, 341 insertions(+)
 create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c

diff --git a/tests/cl.py b/tests/cl.py
index 4668ddc..572ccdc 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -58,6 +58,8 @@ with profile.group_manager(PiglitCLTest, 'api') as g:
 g(['cl-api-enqueue-copy-buffer-rect'], 'clEnqueueCopyBufferRect')
 g(['cl-api-enqueue-read_write-buffer'],
   'clEnqueueReadBuffer and clEnqueueWriteBuffer')
+g(['cl-api-enqueue-read_write-buffer-rect'],
+  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
 g(['cl-api-get-mem-object-info'], 'clGetMemObjectInfo')
 g(['cl-api-get-image-info'], 'clGetImageInfo')
 g(['cl-api-retain_release-mem-object'],
diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index b598528..f0a388f 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -21,6 +21,7 @@ piglit_cl_add_api_test (enqueue-copy-buffer 
enqueue-copy-buffer.c)
 piglit_cl_add_api_test (enqueue-map-buffer enqueue-map-buffer.c)
 piglit_cl_add_api_test (enqueue-copy-buffer-rect enqueue-copy-buffer-rect.c)
 piglit_cl_add_api_test (enqueue-read_write-buffer enqueue-read_write-buffer.c)
+piglit_cl_add_api_test (enqueue-read_write-buffer-rect 
enqueue-read_write-buffer-rect.c)
 piglit_cl_add_api_test (retain_release-mem-object retain_release-mem-object.c)
 piglit_cl_add_api_test (get-mem-object-info get-mem-object-info.c)
 piglit_cl_add_api_test (get-image-info get-image-info.c)
diff --git a/tests/cl/api/enqueue-read_write-buffer-rect.c 
b/tests/cl/api/enqueue-read_write-buffer-rect.c
new file mode 100644
index 000..6f7d2ca
--- /dev/null
+++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
@@ -0,0 +1,338 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Meng Mengmeng mengmeng.meng at intel.com
+ *
+ */
+
+#include piglit-framework-cl-api.h
+#include piglit-util-cl.h
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
+   config.version_min = 11;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+static bool
+test_read_rect(cl_command_queue command_queue,
+   cl_mem buffer,
+   cl_bool blocking_read,
+   const size_t * buffer_origin,
+   const size_t * host_origin,
+   const size_t * region,
+   size_t buffer_row_pitch,
+   size_t buffer_slice_pitch,
+   size_t host_row_pitch,
+   size_t host_slice_pitch,
+   void *ptr,
+   cl_uint num_events_in_wait_list,
+   const cl_event *event_wait_list,
+   cl_event *event,
+   cl_int expected_error,
+   enum piglit_result* result,
+   const char* test_str) {
+   cl_int errNo;
+
+   errNo = clEnqueueReadBufferRect(command_queue,
+   buffer,
+   blocking_read,
+   buffer_origin,
+   host_origin,
+   region,
+   buffer_row_pitch,
+   buffer_slice_pitch,
+   host_row_pitch,
+   host_slice_pitch,
+   ptr,
+   num_events_in_wait_list,
+