[Piglit] [PATCH 1/2] glsl: tidy up link empty program tests

Timothy Arceri timothy.arceri at collabora.com
Mon Jan 25 14:52:15 PST 2016


There are two tests, the second test covers what the first
test is doing plus more, so remove the first test.

Add a check that glUseProgram doesn't generate an error when
linked program is empty.

Finally move the remaining test out of the shaders folder.

Cc: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: Ian Romanick <idr at freedesktop.org>
---
 tests/all.py                                       |  3 +-
 tests/shaders/CMakeLists.gl.txt                    |  2 -
 tests/shaders/glsl-link-empty-prog-01.c            | 53 ----------------------
 tests/spec/gl-2.0/CMakeLists.gl.txt                |  1 +
 .../gl-2.0/glsl-link-empty-prog.c}                 |  2 +
 5 files changed, 4 insertions(+), 57 deletions(-)
 delete mode 100644 tests/shaders/glsl-link-empty-prog-01.c
 rename tests/{shaders/glsl-link-empty-prog-02.c => spec/gl-2.0/glsl-link-empty-prog.c} (98%)

diff --git a/tests/all.py b/tests/all.py
index 8e3cf85..1e720d0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -557,8 +557,6 @@ with profile.group_manager(PiglitGLTest, 'shaders') as g:
     g(['glsl-light-model'])
     g(['glsl-link-bug30552'])
     g(['glsl-link-bug38015'])
-    g(['glsl-link-empty-prog-01'])
-    g(['glsl-link-empty-prog-02'])
     g(['glsl-max-vertex-attrib'])
     g(['glsl-kwin-blur-1'])
     g(['glsl-kwin-blur-2'])
@@ -1080,6 +1078,7 @@ with profile.group_manager(
     g(['gl-2.0-edgeflag'])
     g(['gl-2.0-edgeflag-immediate'])
     g(['gl-2.0-large-point-fs'])
+    g(['gl-2.0-link-empty-prog'])
     g(['gl-2.0-two-sided-stencil'])
     g(['gl-2.0-vertexattribpointer'])
     g(['gl-2.0-vertex-const-attr'])
diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt
index abbe14c..42c6fae 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -111,8 +111,6 @@ piglit_add_executable (glsl-vs-user-varying-ff glsl-vs-user-varying-ff.c)
 piglit_add_executable (glsl-light-model glsl-light-model.c)
 piglit_add_executable (glsl-link-bug30552 glsl-link-bug30552.c)
 piglit_add_executable (glsl-link-bug38015 glsl-link-bug38015.c)
-piglit_add_executable (glsl-link-empty-prog-01 glsl-link-empty-prog-01.c)
-piglit_add_executable (glsl-link-empty-prog-02 glsl-link-empty-prog-02.c)
 piglit_add_executable (glsl-link-initializer-03 glsl-link-initializer-03.c)
 piglit_add_executable (glsl-link-test glsl-link-test.c)
 piglit_add_executable (gpu_shader4_attribs gpu_shader4_attribs.c)
diff --git a/tests/shaders/glsl-link-empty-prog-01.c b/tests/shaders/glsl-link-empty-prog-01.c
deleted file mode 100644
index 88c24d7..0000000
--- a/tests/shaders/glsl-link-empty-prog-01.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2010 Török Edwin
- *
- * 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.
- */
-
-#include "piglit-util-gl.h"
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-	config.supports_gl_compat_version = 10;
-
-	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-enum piglit_result piglit_display(void)
-{
-    GLint objID = glCreateProgram();
-    /* check that it doesn't crash when linking empty shader */
-    glLinkProgram(objID);
-    glValidateProgram(objID);
-    if (!piglit_link_check_status(objID))
-	piglit_report_result(PIGLIT_FAIL);
-    glUseProgram(objID);
-    glUseProgram(0);
-    glDeleteProgram(objID);
-    piglit_report_result(PIGLIT_PASS);
-    return PIGLIT_PASS;
-}
-
-void
-piglit_init(int argc, char **argv)
-{
-	piglit_require_gl_version(20);
-}
diff --git a/tests/spec/gl-2.0/CMakeLists.gl.txt b/tests/spec/gl-2.0/CMakeLists.gl.txt
index 20b315a..b171dea 100644
--- a/tests/spec/gl-2.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-2.0/CMakeLists.gl.txt
@@ -13,6 +13,7 @@ piglit_add_executable (vertex-program-two-side vertex-program-two-side.c)
 piglit_add_executable (gl-2.0-edgeflag edgeflag.c)
 piglit_add_executable (gl-2.0-edgeflag-immediate edgeflag-immediate.c)
 piglit_add_executable (gl-2.0-large-point-fs large-point-fs.c)
+piglit_add_executable (gl-2.0-link-empty-prog glsl-link-empty-prog.c)
 piglit_add_executable (gl-2.0-two-sided-stencil two-sided-stencil.c)
 piglit_add_executable (gl-2.0-vertexattribpointer vertexattribpointer.c)
 piglit_add_executable (gl-2.0-vertex-const-attr vertex-const-attr.c)
diff --git a/tests/shaders/glsl-link-empty-prog-02.c b/tests/spec/gl-2.0/glsl-link-empty-prog.c
similarity index 98%
rename from tests/shaders/glsl-link-empty-prog-02.c
rename to tests/spec/gl-2.0/glsl-link-empty-prog.c
index c684047..3bcfcbc 100644
--- a/tests/shaders/glsl-link-empty-prog-02.c
+++ b/tests/spec/gl-2.0/glsl-link-empty-prog.c
@@ -103,6 +103,8 @@ piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 
 	glUseProgram(prog);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenTextures(1, &tex);
 	glBindTexture(GL_TEXTURE_2D, tex);
-- 
2.4.3



More information about the Piglit mailing list