[Beignet] [PATCH] utests: fix two utest bugs.

Zhigang Gong zhigang.gong at intel.com
Mon Sep 1 19:36:34 PDT 2014


Similar as the bug found by junyan, some events are
accessed before assigned.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 utests/runtime_event.cpp       | 2 +-
 utests/runtime_marker_list.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utests/runtime_event.cpp b/utests/runtime_event.cpp
index b974f6a..f8170a3 100644
--- a/utests/runtime_event.cpp
+++ b/utests/runtime_event.cpp
@@ -28,7 +28,7 @@ void runtime_event(void)
   locals[0] = 32;
   clEnqueueNDRangeKernel(queue, kernel, 1, NULL, globals, locals, 2, &ev[0], &ev[2]);
 
-  for (cl_uint i = 0; i != sizeof(ev) / sizeof(cl_event); ++i) {
+  for (cl_uint i = 0; i < 3; ++i) {
     clGetEventInfo(ev[i], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(status), &status, NULL);
     OCL_ASSERT(status >= CL_SUBMITTED);
   }
diff --git a/utests/runtime_marker_list.cpp b/utests/runtime_marker_list.cpp
index fc77156..f64b1d1 100644
--- a/utests/runtime_marker_list.cpp
+++ b/utests/runtime_marker_list.cpp
@@ -34,7 +34,7 @@ void runtime_marker_list(void)
 
   clEnqueueNDRangeKernel(queue, kernel, 1, NULL, globals, locals, 2, &ev[0], &ev[2]);
 
-  for (cl_uint i = 0; i != sizeof(ev) / sizeof(cl_event); ++i) {
+  for (cl_uint i = 0; i < 3; ++i) {
     clGetEventInfo(ev[i], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(status), &status, NULL);
     OCL_ASSERT(status >= CL_SUBMITTED);
   }
-- 
1.8.3.2



More information about the Beignet mailing list