[Piglit] [PATCH] glslparsertest: Also call glLinkShader on shaders that compiled.

Eric Anholt eric at anholt.net
Wed Jun 15 08:51:12 PDT 2011


This doesn't impact the piglit results (since the shaders are not
categorized according to whether they're expected to link, and many
aren't), unless glLinkShader happens to cause a crash.  However, doing
this increases coverage of the shader linking code, and also means
that glslparsertest can be used in analysis using shader-db.
---
 tests/glslparsertest/glslparsertest.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c
index 6a20a0d..a1c3913 100644
--- a/tests/glslparsertest/glslparsertest.c
+++ b/tests/glslparsertest/glslparsertest.c
@@ -173,6 +173,23 @@ test(void)
 		}
 	}
 
+	/* Try linking the shader if it compiled.  We don't care about
+	 * the success or failure of linking for the purposes of
+	 * parser tests, we're just trying to increase coverage of
+	 * that code.  It also means that drivers that do a compile at
+	 * link time (to determine limits) get a chance to expose
+	 * their codegen to the parser tests, even if we don't ever
+	 * execute it.
+	 */
+	if (ok) {
+		GLuint shader_prog;
+
+		shader_prog = piglit_CreateProgram();
+		piglit_AttachShader(shader_prog, prog);
+		piglit_LinkProgram(shader_prog);
+		piglit_DeleteProgram(shader_prog);
+	}
+
 	if (size != 0)
 		free(info);
 	free(prog_string);
-- 
1.7.5.3



More information about the Piglit mailing list