[Piglit] [PATCH 2/6] Replace some C code GLSL linker tests with glsl-link-test

Ian Romanick idr at freedesktop.org
Fri Oct 28 15:26:53 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/all.tests                          |   18 +++---
 tests/shaders/CMakeLists.gl.txt          |    5 --
 tests/shaders/glsl-link-initializer-01.c |   82 ------------------------------
 tests/shaders/glsl-link-initializer-02.c |   78 ----------------------------
 tests/shaders/glsl-link-initializer-04.c |   71 --------------------------
 tests/shaders/glsl-link-initializer-05.c |   71 --------------------------
 tests/shaders/glsl-link-initializer-06.c |   76 ---------------------------
 7 files changed, 9 insertions(+), 392 deletions(-)
 delete mode 100644 tests/shaders/glsl-link-initializer-01.c
 delete mode 100644 tests/shaders/glsl-link-initializer-02.c
 delete mode 100644 tests/shaders/glsl-link-initializer-04.c
 delete mode 100644 tests/shaders/glsl-link-initializer-05.c
 delete mode 100644 tests/shaders/glsl-link-initializer-06.c

diff --git a/tests/all.tests b/tests/all.tests
index ce701b8..8f50306 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -465,15 +465,15 @@ add_plain_test(shaders, 'glsl-link-bug30552')
 add_plain_test(shaders, 'glsl-link-bug38015')
 add_plain_test(shaders, 'glsl-link-empty-prog-01')
 add_plain_test(shaders, 'glsl-link-empty-prog-02')
-add_plain_test(shaders, 'glsl-link-initializer-01')
-add_plain_test(shaders, 'glsl-link-initializer-02')
-add_plain_test(shaders, 'glsl-link-initializer-03')
-add_plain_test(shaders, 'glsl-link-initializer-04')
-add_plain_test(shaders, 'glsl-link-initializer-05')
-add_plain_test(shaders, 'glsl-link-initializer-06')
-add_plain_test(shaders, 'glsl-link-invariant-01')
-add_plain_test(shaders, 'glsl-link-centroid-01')
-add_plain_test(shaders, 'glsl-link-struct-array')
+shaders['GLSL link mismatched global initializer, 3 shaders'] = concurrent_test('glsl-link-test shaders/glsl-link-initializer-01a.vert shaders/glsl-link-initializer-01b.vert shaders/glsl-link-initializer-01c.vert fail')
+shaders['GLSL link mismatched global const initializer'] = concurrent_test('glsl-link-test shaders/glsl-link-initializer-02a.vert shaders/glsl-link-initializer-02b.vert fail')
+shaders['GLSL link matched global initializer'] = concurrent_test('glsl-link-test shaders/glsl-link-initializer-04a.vert shaders/glsl-link-initializer-04b.vert pass')
+shaders['GLSL link two programs, global initializer'] = concurrent_test('glsl-link-initializer-03')
+shaders['GLSL link matched global initializer expression'] = concurrent_test('glsl-link-test shaders/glsl-link-initializer-05a.vert shaders/glsl-link-initializer-05b.vert pass')
+shaders['GLSL link mismatched global initializer expression'] = concurrent_test('glsl-link-test shaders/glsl-link-initializer-06a.vert shaders/glsl-link-initializer-06b.vert fail')
+shaders['GLSL link mismatched invariant'] = concurrent_test('glsl-link-test shaders/glsl-link-invariant-01a.vert shaders/glsl-link-invariant-01b.vert fail')
+shaders['GLSL link mismatched centroid'] = concurrent_test('glsl-link-test shaders/glsl-link-centroid-01a.vert shaders/glsl-link-centroid-01b.vert fail')
+shaders['GLSL link array-of-struct-of-array'] = concurrent_test('glsl-link-test shaders/glsl-link-struct-array.frag pass')
 add_plain_test(shaders, 'glsl-max-vertex-attrib')
 add_plain_test(shaders, 'glsl-kwin-blur-1')
 add_plain_test(shaders, 'glsl-kwin-blur-2')
diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt
index 1bf73e8..d115dea 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -117,12 +117,7 @@ add_executable (glsl-link-bug30552 glsl-link-bug30552.c)
 add_executable (glsl-link-bug38015 glsl-link-bug38015.c)
 add_executable (glsl-link-empty-prog-01 glsl-link-empty-prog-01.c)
 add_executable (glsl-link-empty-prog-02 glsl-link-empty-prog-02.c)
-add_executable (glsl-link-initializer-01 glsl-link-initializer-01.c)
-add_executable (glsl-link-initializer-02 glsl-link-initializer-02.c)
 add_executable (glsl-link-initializer-03 glsl-link-initializer-03.c)
-add_executable (glsl-link-initializer-04 glsl-link-initializer-04.c)
-add_executable (glsl-link-initializer-05 glsl-link-initializer-05.c)
-add_executable (glsl-link-initializer-06 glsl-link-initializer-06.c)
 add_executable (glsl-link-invariant-01 glsl-link-invariant-01.c)
 add_executable (glsl-link-centroid-01 glsl-link-centroid-01.c)
 add_executable (glsl-link-struct-array glsl-link-struct-array.c)
diff --git a/tests/shaders/glsl-link-initializer-01.c b/tests/shaders/glsl-link-initializer-01.c
deleted file mode 100644
index 11c8146..0000000
--- a/tests/shaders/glsl-link-initializer-01.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright © 2010 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.
- */
-
-/**
- * \file glsl-link-initializer-01.c
- * Test conflicting variable initializers.
- *
- * Each of the 3 shaders involved in this test have a global variable called
- * \c global_variable.  Two of the shaders have (differing) initializers for
- * this variable, and the other lacks an initalizer.  The test verifies that
- * linking the 3 shaders together results in an error due to the conflicting
- * initializer.
- *
- * \author Ian Romanick
- */
-
-#include "piglit-util.h"
-
-int piglit_width = 100, piglit_height = 100;
-int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-
-enum piglit_result
-piglit_display(void)
-{
-	return PIGLIT_FAIL;
-}
-
-void piglit_init(int argc, char **argv)
-{
-	GLint vert[3];
-	GLint prog;
-	GLboolean ok;
-
-	if (!GLEW_VERSION_2_0) {
-		printf("Requires OpenGL 2.0\n");
-		piglit_report_result(PIGLIT_SKIP);
-	}
-
-	vert[0] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-01a.vert");
-	vert[1] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-01b.vert");
-	vert[2] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-01c.vert");
-	prog = glCreateProgram();
-	glAttachShader(prog, vert[0]);
-	glAttachShader(prog, vert[1]);
-	glAttachShader(prog, vert[2]);
-	glLinkProgram(prog);
-
-	ok = piglit_link_check_status_quiet(prog);
-	if (ok)
-		fprintf(stderr,
-			"Program should have failed linking, but "
-			"it was (incorrectly) successful.\n");
-
-	piglit_report_result((!ok) ? PIGLIT_PASS : PIGLIT_FAIL);
-}
-
diff --git a/tests/shaders/glsl-link-initializer-02.c b/tests/shaders/glsl-link-initializer-02.c
deleted file mode 100644
index c5d1c1c..0000000
--- a/tests/shaders/glsl-link-initializer-02.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright © 2010 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.
- */
-
-/**
- * \file glsl-link-initializer-02.c
- * Test conflicting constant initializers.
- *
- * Each of the 2 shaders involved in this test have a global constant called
- * \c global_const.  Each has a different initializer for the constant.  The
- * test verifies that linking the shaders together results in an error due to
- * the conflicting initializer.
- *
- * \author Ian Romanick
- */
-
-#include "piglit-util.h"
-
-int piglit_width = 100, piglit_height = 100;
-int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-
-enum piglit_result
-piglit_display(void)
-{
-	return PIGLIT_FAIL;
-}
-
-void piglit_init(int argc, char **argv)
-{
-	GLint vert[2];
-	GLint prog;
-	GLboolean ok;
-
-	if (!GLEW_VERSION_2_0) {
-		printf("Requires OpenGL 2.0\n");
-		piglit_report_result(PIGLIT_SKIP);
-	}
-
-	vert[0] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-02a.vert");
-	vert[1] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-02b.vert");
-
-	prog = glCreateProgram();
-	glAttachShader(prog, vert[0]);
-	glAttachShader(prog, vert[1]);
-	glLinkProgram(prog);
-
-	ok = piglit_link_check_status_quiet(prog);
-	if (ok)
-		fprintf(stderr,
-			"Program should have failed linking, but "
-			"it was (incorrectly) successful.\n");
-
-	piglit_report_result((!ok) ? PIGLIT_PASS : PIGLIT_FAIL);
-}
-
diff --git a/tests/shaders/glsl-link-initializer-04.c b/tests/shaders/glsl-link-initializer-04.c
deleted file mode 100644
index 9c08bba..0000000
--- a/tests/shaders/glsl-link-initializer-04.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2010 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.
- */
-
-/**
- * \file glsl-link-initializer-04.c
- * Test non-conflicting variable initializers.
- *
- * Each of the 2 shaders involved in this test have a global variable called
- * \c global_variable.  Each has the same initializer for the variable.  The
- * test verifies that linking the shaders together is successful.
- *
- * \author Ian Romanick
- */
-
-#include "piglit-util.h"
-
-int piglit_width = 100, piglit_height = 100;
-int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-
-enum piglit_result
-piglit_display(void)
-{
-	return PIGLIT_FAIL;
-}
-
-void piglit_init(int argc, char **argv)
-{
-	GLint vert[2];
-	GLint prog;
-	GLboolean ok;
-
-	if (!GLEW_VERSION_2_0) {
-		printf("Requires OpenGL 2.0\n");
-		piglit_report_result(PIGLIT_SKIP);
-	}
-
-	vert[0] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-04a.vert");
-	vert[1] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-04b.vert");
-	prog = glCreateProgram();
-	glAttachShader(prog, vert[0]);
-	glAttachShader(prog, vert[1]);
-	glLinkProgram(prog);
-
-	ok = piglit_link_check_status(prog);
-	piglit_report_result(ok ? PIGLIT_PASS : PIGLIT_FAIL);
-}
-
diff --git a/tests/shaders/glsl-link-initializer-05.c b/tests/shaders/glsl-link-initializer-05.c
deleted file mode 100644
index 3c9eb52..0000000
--- a/tests/shaders/glsl-link-initializer-05.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2010 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.
- */
-
-/**
- * \file glsl-link-initializer-05.c
- * Test variables with complex non-conflicting initializers.
- *
- * Each of the 2 shaders involved in this test have a global variable called
- * \c global_variable.  Each has the same initializer for the variable.  The
- * test verifies that linking the shaders together is successful.
- *
- * \author Ian Romanick
- */
-
-#include "piglit-util.h"
-
-int piglit_width = 100, piglit_height = 100;
-int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-
-enum piglit_result
-piglit_display(void)
-{
-	return PIGLIT_FAIL;
-}
-
-void piglit_init(int argc, char **argv)
-{
-	GLint vert[2];
-	GLint prog;
-	GLboolean ok;
-
-	if (!GLEW_VERSION_2_0) {
-		printf("Requires OpenGL 2.0\n");
-		piglit_report_result(PIGLIT_SKIP);
-	}
-
-	vert[0] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-05a.vert");
-	vert[1] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-05b.vert");
-	prog = glCreateProgram();
-	glAttachShader(prog, vert[0]);
-	glAttachShader(prog, vert[1]);
-	glLinkProgram(prog);
-
-	ok = piglit_link_check_status(prog);
-	piglit_report_result(ok ? PIGLIT_PASS : PIGLIT_FAIL);
-}
-
diff --git a/tests/shaders/glsl-link-initializer-06.c b/tests/shaders/glsl-link-initializer-06.c
deleted file mode 100644
index e303173..0000000
--- a/tests/shaders/glsl-link-initializer-06.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright © 2010 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.
- */
-
-/**
- * \file glsl-link-initializer-06.c
- * Test variables with complex non-conflicting initializers.
- *
- * Each of the 2 shaders involved in this test have a global variable called
- * \c global_variable.  Each has the same initializer for the variable.  The
- * test verifies that linking the shaders together is successful.
- *
- * \author Ian Romanick
- */
-
-#include "piglit-util.h"
-
-int piglit_width = 100, piglit_height = 100;
-int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-
-enum piglit_result
-piglit_display(void)
-{
-	return PIGLIT_FAIL;
-}
-
-void piglit_init(int argc, char **argv)
-{
-	GLint vert[2];
-	GLint prog;
-	GLboolean ok;
-
-	if (!GLEW_VERSION_2_0) {
-		printf("Requires OpenGL 2.0\n");
-		piglit_report_result(PIGLIT_SKIP);
-	}
-
-	vert[0] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-06a.vert");
-	vert[1] =
-		piglit_compile_shader(GL_VERTEX_SHADER,
-				      "shaders/glsl-link-initializer-06b.vert");
-	prog = glCreateProgram();
-	glAttachShader(prog, vert[0]);
-	glAttachShader(prog, vert[1]);
-	glLinkProgram(prog);
-
-	ok = piglit_link_check_status_quiet(prog);
-	if (ok)
-		fprintf(stderr,
-			"Program should have failed linking, but "
-			"it was (incorrectly) successful.\n");
-
-	piglit_report_result((!ok) ? PIGLIT_PASS : PIGLIT_FAIL);
-}
-
-- 
1.7.6.4



More information about the Piglit mailing list