Use _exit() instead of exit() in child processes
[piglit.git] / tests / egl / egl-blob-cache.c
blob81af606fe531447e8813cc6ebe025e6cfdd6043a
1 /*
2 * Copyright © 2017 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
24 #include "piglit-util-egl.h"
25 #include "piglit-util-gl.h"
27 /**
28 * @file egl-blob-cache.c
30 * EGL API tests for EGL_ANDROID_blob_cache extension:
31 * https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_blob_cache.txt
34 PIGLIT_GL_TEST_CONFIG_BEGIN
36 config.supports_gl_es_version = 20;
38 PIGLIT_GL_TEST_CONFIG_END
40 /* dummy */
41 enum piglit_result
42 piglit_display(void)
44 return PIGLIT_FAIL;
47 static void
48 set_blob(const void* key, EGLsizeiANDROID keySize,
49 const void* value, EGLsizeiANDROID valueSize)
53 static EGLsizeiANDROID
54 get_blob(const void* key, EGLsizeiANDROID keySize, void* value,
55 EGLsizeiANDROID valueSize)
57 return 0;
60 void
61 piglit_init(int argc, char **argv)
63 EGLint major, minor;
64 EGLDisplay dpy;
66 /* Require EGL_MESA_platform_surfaceless extension. */
67 const char *exts = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
68 if (!strstr(exts, "EGL_MESA_platform_surfaceless"))
69 piglit_report_result(PIGLIT_SKIP);
71 dpy = piglit_egl_get_default_display(EGL_PLATFORM_SURFACELESS_MESA);
73 if (!eglInitialize(dpy, &major, &minor))
74 piglit_report_result(PIGLIT_FAIL);
76 piglit_require_egl_extension(dpy, "EGL_MESA_configless_context");
77 piglit_require_egl_extension(dpy, "EGL_ANDROID_blob_cache");
79 PFNEGLSETBLOBCACHEFUNCSANDROIDPROC peglSetBlobCacheFuncs =
80 (PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)
81 eglGetProcAddress ("eglSetBlobCacheFuncsANDROID");
83 if (!peglSetBlobCacheFuncs)
84 piglit_report_result(PIGLIT_FAIL);
86 #define EXPECT(x) if (!piglit_check_egl_error(x)) piglit_report_result(PIGLIT_FAIL);
88 /* Check error cases for passing NULL. */
89 peglSetBlobCacheFuncs(dpy, NULL, NULL);
90 EXPECT(EGL_BAD_PARAMETER);
92 peglSetBlobCacheFuncs(dpy, set_blob, NULL);
93 EXPECT(EGL_BAD_PARAMETER);
95 peglSetBlobCacheFuncs(dpy, NULL, get_blob);
96 EXPECT(EGL_BAD_PARAMETER);
98 /* Successful call. */
99 peglSetBlobCacheFuncs(dpy, set_blob, get_blob);
100 EXPECT(EGL_SUCCESS);
102 /* Failure, functions already set. */
103 peglSetBlobCacheFuncs(dpy, set_blob, get_blob);
104 EXPECT(EGL_BAD_PARAMETER);
106 #undef EXPECT
108 piglit_report_result(PIGLIT_PASS);