[Piglit] [PATCH v2 12/12] egl_android_native_fence_sync: Verify that dup() fails on invalid fence.
Rafael Antognolli
rafael.antognolli at intel.com
Mon Nov 7 23:05:14 UTC 2016
If <sync> is not a valid sync object for <dpy>,
EGL_NO_NATIVE_FENCE_FD_ANDROID is returned and an EGL_BAD_PARAMETER
error is generated.
Signed-off-by: Rafael Antognolli <rafael.antognolli at intel.com>
---
.../egl_android_native_fence_sync.c | 49 ++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tests/egl/spec/egl_android_native_fence_sync/egl_android_native_fence_sync.c b/tests/egl/spec/egl_android_native_fence_sync/egl_android_native_fence_sync.c
index eea4f0e..05f6b20 100644
--- a/tests/egl/spec/egl_android_native_fence_sync/egl_android_native_fence_sync.c
+++ b/tests/egl/spec/egl_android_native_fence_sync/egl_android_native_fence_sync.c
@@ -512,6 +512,50 @@ cleanup:
}
/**
+ * Verify that eglDupNativeFenceFDANDROID emits correct error when given an
+ * invalid sync .
+ *
+ * From the EGL_ANDROID_native_fence_sync spec:
+ *
+ * If <sync> is not a valid sync object for <dpy>,
+ * EGL_NO_NATIVE_FENCE_FD_ANDROID is returned and an EGL_BAD_PARAMETER
+ * error is generated.
+ */
+static enum piglit_result
+test_eglCreateSyncKHR_native_dup_invalid(void *test_data)
+{
+ enum piglit_result result = PIGLIT_PASS;
+ EGLSyncKHR invalid_sync = (EGLSyncKHR) &canary;
+ EGLint sync_fd = canary;
+
+ result = test_setup();
+ if (result != PIGLIT_PASS) {
+ return result;
+ }
+
+ sync_fd = peglDupNativeFenceFDANDROID(g_dpy, invalid_sync);
+ if (sync_fd != EGL_NO_NATIVE_FENCE_FD_ANDROID) {
+ piglit_loge("Given an invalid sync object, "
+ "eglDupNativeFenceFDANDROID() should return "
+ "EGL_NO_NATIVE_FENCE_FD_ANDROID, "
+ "but returned %d", sync_fd);
+ close(sync_fd);
+ result = PIGLIT_FAIL;
+ goto cleanup;
+ }
+ if (!piglit_check_egl_error(EGL_BAD_PARAMETER)) {
+ piglit_loge("Given an invalid sync object, "
+ "eglDupNativeFenceFDANDROID() "
+ "did not emit EGL_BAD_PARAMETER");
+ result = PIGLIT_FAIL;
+ }
+
+cleanup:
+ test_cleanup(EGL_NO_SYNC_KHR, &result);
+ return result;
+}
+
+/**
* Verify that eglCreateSyncKHR emits correct error when given an invalid
* display.
*
@@ -942,6 +986,11 @@ static const struct piglit_subtest fence_sync_subtests[] = {
test_eglCreateSyncKHR_native_dup_fence,
},
{
+ "eglCreateSyncKHR_native_dup_invalid",
+ "eglCreateSyncKHR_native_dup_invalid",
+ test_eglCreateSyncKHR_native_dup_invalid,
+ },
+ {
"eglCreateSyncKHR_invalid_display",
"eglCreateSyncKHR_invalid_display",
test_eglCreateSyncKHR_native_invalid_display,
--
2.7.4
More information about the Piglit
mailing list