[Piglit] [PATCH] cl: From API clRetain* tests, removed attempt to release already released and destroyed objects

Ville Korhonen ville.t.korhonen at tut.fi
Wed Aug 21 06:16:47 PDT 2013


All retain/release API tests try to test behaviour when trying to  
release already released and destroyed object. OpenCL 1.2 Spec says  
(considering clReleaseMemObject:

"After the memobj reference count becomes zero and commands queued for  
execution on a command-queue(s) that use memobj have finished, the  
memory object is deleted. If memobj is a buffer object, memobj cannot  
be deleted until all sub-buffer objects associated with memobj are  
deleted."

Calling release to a released object causes segmentation fault when  
using ICD Loader.

Also test create-context checks error message when num_devices is  
zero, but given num_devices was a valid number. Changed function call  
to actually pass zero to the function.


diff --git a/tests/cl/api/create-context.c b/tests/cl/api/create-context.c
index 7858940..39150d0 100644
--- a/tests/cl/api/create-context.c
+++ b/tests/cl/api/create-context.c
@@ -251,7 +251,7 @@ piglit_cl_test(const int argc,
  	test(context_properties, num_devices, NULL, NULL, NULL,
  	     CL_INVALID_VALUE, &result,
  	     "Trigger CL_INVALID_VALUE if devices is NULL");
-	test(context_properties, num_devices, devices, NULL, &context_properties,
+	test(context_properties, 0, devices, NULL, &context_properties,
  	     CL_INVALID_VALUE, &result,
  	     "Trigger CL_INVALID_VALUE if num_devices is equal to zero");
  	test(context_properties, 0, devices, NULL, NULL,
diff --git a/tests/cl/api/get-platform-info.c  
b/tests/cl/api/get-platform-info.c
index c5cd4e0..cf61586 100644
--- a/tests/cl/api/get-platform-info.c
+++ b/tests/cl/api/get-platform-info.c
@@ -154,21 +154,5 @@ piglit_cl_test(const int argc,
  		piglit_merge_result(&result, PIGLIT_FAIL);
  	}

-	/*
-	 * CL_INVALID_PLATFORM if platform is not a valid platform.
-	 */
-	errNo = clGetPlatformInfo(invalid_platform_id,
-	                          CL_PLATFORM_PROFILE,
-	                          0,
-	                          NULL,
-	                          &param_value_size);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_PLATFORM)) {
-		fprintf(stderr,
-		        "Failed (error code: %s): Trigger CL_INVALID_PLATFORM if  
platform is not a valid platform.\n",
-		        piglit_cl_get_error_name(errNo));
-		piglit_merge_result(&result, PIGLIT_FAIL);
-	}
-
-
-	return result;
+    return result;
  }
diff --git a/tests/cl/api/retain_release-command-queue.c  
b/tests/cl/api/retain_release-command-queue.c
index a4e8ffb..3eb746c 100644
--- a/tests/cl/api/retain_release-command-queue.c
+++ b/tests/cl/api/retain_release-command-queue.c
@@ -139,25 +139,5 @@ piglit_cl_test(const int argc,
  		}
  	}

-	/*** Errors ***/
-
-	/*
-	 * CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
-	 */
-	errNo = clReleaseCommandQueue(command_queue);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_COMMAND_QUEUE)) {
-			fprintf(stderr,
-			        "clReleaseCommandQueue: Failed (error code: %s): Trigger  
CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue  
(already released).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-	errNo = clReleaseCommandQueue(NULL);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_COMMAND_QUEUE)) {
-			fprintf(stderr,
-			        "clReleaseCommandQueue: Failed (error code: %s): Trigger  
CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue  
(NULL).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-
  	return PIGLIT_PASS;
  }
diff --git a/tests/cl/api/retain_release-context.c  
b/tests/cl/api/retain_release-context.c
index 6aaa4d9..b2bcd78 100644
--- a/tests/cl/api/retain_release-context.c
+++ b/tests/cl/api/retain_release-context.c
@@ -148,25 +148,5 @@ piglit_cl_test(const int argc,
  		}
  	}

-	/*** Errors ***/
-
-	/*
-	 * CL_INVALID_CONTEXT if context is not a valid OpenCL context.
-	 */
-	errNo = clReleaseContext(cl_ctx);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_CONTEXT)) {
-			fprintf(stderr,
-			        "clReleaseContext: Failed (error code: %s): Trigger  
CL_INVALID_CONTEXT if context is not a valid context (already  
released).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-	errNo = clReleaseContext(NULL);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_CONTEXT)) {
-			fprintf(stderr,
-			        "clReleaseContext: Failed (error code: %s): Trigger  
CL_INVALID_CONTEXT if context is not a valid context (NULL).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-
  	return PIGLIT_PASS;
  }
diff --git a/tests/cl/api/retain_release-event.c  
b/tests/cl/api/retain_release-event.c
index bfff199..f1a8170 100644
--- a/tests/cl/api/retain_release-event.c
+++ b/tests/cl/api/retain_release-event.c
@@ -149,27 +149,5 @@ piglit_cl_test(const int argc,
  		}
  	}

-	/*** Errors ***/
-
-	/*
-	 * CL_INVALID_EVENT if event is not a valid event object.
-	 */
-	errNo = clReleaseEvent(event);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_EVENT)) {
-			fprintf(stderr,
-			        "clReleaseEvent: Failed (error code: %s): Trigger  
CL_INVALID_EVENT if event is not a valid event object (already  
released).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-	errNo = clReleaseEvent(NULL);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_EVENT)) {
-			fprintf(stderr,
-			        "clReleaseEvent: Failed (error code: %s): Trigger  
CL_INVALID_EVENT if event is not a valid event object (NULL).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-
-	clReleaseMemObject(memobj);
-
  	return PIGLIT_PASS;
  }
diff --git a/tests/cl/api/retain_release-kernel.c  
b/tests/cl/api/retain_release-kernel.c
index 94857d2..4bad2de 100644
--- a/tests/cl/api/retain_release-kernel.c
+++ b/tests/cl/api/retain_release-kernel.c
@@ -137,25 +137,5 @@ piglit_cl_test(const int argc,
  		}
  	}

-	/*** Errors ***/
-
-	/*
-	 * CL_INVALID_KERNEL if kernel is not a valid kernel object.
-	 */
-	errNo = clReleaseKernel(kernel);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_KERNEL)) {
-			fprintf(stderr,
-			        "clReleaseKernel: Failed (error code: %s): Trigger  
CL_INVALID_KERNEL if kernel is not a valid kernel object (already  
released).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-	errNo = clReleaseKernel(NULL);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_KERNEL)) {
-			fprintf(stderr,
-			        "clReleaseKernel: Failed (error code: %s): Trigger  
CL_INVALID_KERNEL if kernel is not a valid kernel object (NULL).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-
  	return PIGLIT_PASS;
  }
diff --git a/tests/cl/api/retain_release-mem-object.c  
b/tests/cl/api/retain_release-mem-object.c
index ae4555f..286d46e 100644
--- a/tests/cl/api/retain_release-mem-object.c
+++ b/tests/cl/api/retain_release-mem-object.c
@@ -138,26 +138,5 @@ piglit_cl_test(const int argc,
  		}
  	}

-	/*** Errors ***/
-
-	/*
-	 * CL_INVALID_MEM_OBJECT if mem_object is not a valid mem_object object
-	 * (buffer or image object).
-	 */
-	errNo = clReleaseMemObject(memobj);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_MEM_OBJECT)) {
-			fprintf(stderr,
-			        "clReleaseMemObject: Failed (error code: %s): Trigger  
CL_INVALID_MEM_OBJECT if memOBJ is not a valid memory object (already  
released).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-	errNo = clReleaseMemObject(NULL);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_MEM_OBJECT)) {
-			fprintf(stderr,
-			        "clReleaseMemObject: Failed (error code: %s): Trigger  
CL_INVALID_MEM_OBJECT if memobj is not a valid memory object (NULL).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-
  	return PIGLIT_PASS;
  }
diff --git a/tests/cl/api/retain_release-program.c  
b/tests/cl/api/retain_release-program.c
index aba5426..cf20dc8 100644
--- a/tests/cl/api/retain_release-program.c
+++ b/tests/cl/api/retain_release-program.c
@@ -140,25 +140,5 @@ piglit_cl_test(const int argc,
  		}
  	}

-	/*** Errors ***/
-
-	/*
-	 * CL_INVALID_PROGRAM if program is not a valid program object.
-	 */
-	errNo = clReleaseProgram(program);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_PROGRAM)) {
-			fprintf(stderr,
-			        "clReleaseProgram: Failed (error code: %s): Trigger  
CL_INVALID_PROGRAM if program is not a valid program object (already  
released).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-	errNo = clReleaseProgram(NULL);
-	if(!piglit_cl_check_error(errNo, CL_INVALID_PROGRAM)) {
-			fprintf(stderr,
-			        "clReleaseProgram: Failed (error code: %s): Trigger  
CL_INVALID_PROGRAM if program is not a valid program object (NULL).\n",
-			        piglit_cl_get_error_name(errNo));
-		return PIGLIT_FAIL;
-	}
-
  	return PIGLIT_PASS;
  }




More information about the Piglit mailing list