ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / ext_memory_object_fd / api-errors.c
blob8ad89fd94230c3bab6b56d2f4a2181c66fb28dbf
1 /*
2 * Copyright (c) 2017 Valve Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation on
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS AND/OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 /**
25 * Tests that api errors are thrown where expected for the
26 * GL_EXT_memory_object_fd extension.
29 #include "piglit-util-gl.h"
31 PIGLIT_GL_TEST_CONFIG_BEGIN
33 config.supports_gl_compat_version = 10;
34 config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
35 config.khr_no_error_support = PIGLIT_HAS_ERRORS;
37 PIGLIT_GL_TEST_CONFIG_END
39 static bool
40 test_import_memory_object_fd_enum_errors()
42 GLuint mem;
43 int fd = -1;
45 glCreateMemoryObjectsEXT(1, &mem);
47 /**
48 * The spec does not define any errors for ImportMemoryFdEXT,
49 * but we should at least make sure this doesn't succeed.
51 glImportMemoryFdEXT(mem, 1, GL_NONE, fd);
53 return piglit_check_gl_error(GL_INVALID_ENUM);
56 #define X(f, desc) \
57 do { \
58 const bool subtest_pass = (f); \
59 piglit_report_subtest_result(subtest_pass \
60 ? PIGLIT_PASS : PIGLIT_FAIL, \
61 (desc)); \
62 pass = pass && subtest_pass; \
63 } while (0)
65 enum piglit_result
66 piglit_display(void)
68 bool pass = true;
70 X(test_import_memory_object_fd_enum_errors(), "import-memory-object-fd-bad-enum");
72 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
76 void
77 piglit_init(int argc, char **argv)
79 /* From the EXT_external_objects_fd spec:
81 * "GL_EXT_memory_object_fd requires GL_EXT_memory_object"
83 piglit_require_extension("GL_EXT_memory_object");
84 piglit_require_extension("GL_EXT_memory_object_fd");