[Piglit] [PATCH 2/2] gl-3.1: test for linking error with an empty program
Timothy Arceri
timothy.arceri at collabora.com
Mon Jan 25 14:52:16 PST 2016
>From Section 7.3 (PROGRAM OBJECTS) of the OpenGL 4.5 spec:
"Linking can fail for a variety of reasons as specified in the
OpenGL Shading Language Specification, as well as any of the
following reasons:
- No shader objects are attached to program."
Cc: Ian Romanick <idr at freedesktop.org>
---
tests/all.py | 1 +
tests/spec/gl-3.1/CMakeLists.gl.txt | 1 +
tests/spec/gl-3.1/glsl-link-empty-prog.c | 70 ++++++++++++++++++++++++++++++++
3 files changed, 72 insertions(+)
create mode 100644 tests/spec/gl-3.1/glsl-link-empty-prog.c
diff --git a/tests/all.py b/tests/all.py
index 1e720d0..54aba72 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1187,6 +1187,7 @@ with profile.group_manager(
g(['gl-3.1-default-vao'], 'default-vao')
g(['gl-3.1-draw-buffers-errors'], 'draw-buffers-errors')
g(['gl-3.1-genned-names'], 'genned-names')
+ g(['gl-3.1-link-empty-prog-core'])
g(['gl-3.1-minmax'], 'minmax')
g(['gl-3.1-vao-broken-attrib'], 'vao-broken-attrib')
g(['gl-3.0-required-renderbuffer-attachment-formats', '31'],
diff --git a/tests/spec/gl-3.1/CMakeLists.gl.txt b/tests/spec/gl-3.1/CMakeLists.gl.txt
index 0a1a97c..9c6472a 100644
--- a/tests/spec/gl-3.1/CMakeLists.gl.txt
+++ b/tests/spec/gl-3.1/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (
piglit_add_executable (gl-3.1-default-vao default-vao.c)
piglit_add_executable (gl-3.1-draw-buffers-errors draw-buffers-errors.c)
piglit_add_executable (gl-3.1-genned-names genned-names.c)
+piglit_add_executable (gl-3.1-link-empty-prog-core glsl-link-empty-prog.c)
piglit_add_executable (gl-3.1-minmax minmax.c)
piglit_add_executable (gl-3.1-primitive-restart-xfb primitive-restart-xfb.c)
piglit_add_executable (gl-3.1-vao-broken-attrib vao-broken-attrib.c)
diff --git a/tests/spec/gl-3.1/glsl-link-empty-prog.c b/tests/spec/gl-3.1/glsl-link-empty-prog.c
new file mode 100644
index 0000000..1f3f9bb
--- /dev/null
+++ b/tests/spec/gl-3.1/glsl-link-empty-prog.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * From Section 7.3 (PROGRAM OBJECTS) of the OpenGL 4.5 spec:
+ *
+ * "Linking can fail for a variety of reasons as specified in the OpenGL
+ * Shading Language Specification, as well as any of the following reasons:
+ *
+ * - No shader objects are attached to program."
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_core_version = 31;
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLint objID = glCreateProgram();
+
+ /* Check the link status is set to false */
+ glLinkProgram(objID);
+ if (piglit_link_check_status(objID))
+ piglit_report_result(PIGLIT_FAIL);
+
+ /* UseProgram should throw an error when the program has not been
+ * successfully linked.
+ */
+ glUseProgram(objID);
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+ piglit_report_result(PIGLIT_FAIL);
+
+ glDeleteProgram(objID);
+
+ piglit_report_result(PIGLIT_PASS);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ /* Should never be reached */
+ return PIGLIT_FAIL;
+}
--
2.4.3
More information about the Piglit
mailing list