<div dir="ltr">On 17 February 2013 10:31, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">To prepare for supporting negative linker tests.<br>
<br>
Signed-off-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
---<br>
 tests/shaders/shader_runner.c |   48 +++++++++++++++++++++++++----------------<br>
 1 file changed, 30 insertions(+), 18 deletions(-)<br>
<br>
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c<br>
index eae5063..2293b9e 100644<br>
--- a/tests/shaders/shader_runner.c<br>
+++ b/tests/shaders/shader_runner.c<br>
@@ -97,6 +97,9 @@ const char *vertex_data_start = NULL;<br>
 const char *vertex_data_end = NULL;<br>
 GLuint prog;<br>
 size_t num_vbo_rows = 0;<br>
+bool link_ok = false;<br>
+bool prog_in_use = false;<br>
+GLchar *prog_err_info = NULL;<br>
<br>
 enum states {<br>
        none = 0,<br>
@@ -319,6 +322,8 @@ compile_and_bind_program(GLenum target, const char *start, int len)<br>
<br>
        glEnable(target);<br>
        glBindProgramARB(target, prog);<br>
+       link_ok = true;<br>
+       prog_in_use = true;<br>
 }<br>
<br>
 /**<br>
@@ -789,38 +794,31 @@ link_and_use_shaders(void)<br>
        }<br>
<br>
        glGetProgramiv(prog, GL_LINK_STATUS, &ok);<br>
-       if (!ok) {<br>
-               GLchar *info;<br>
+       if (ok) {<br>
+               link_ok = true;<br>
+       } else {<br>
                GLint size;<br>
<br>
                glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);<br>
-               info = malloc(size);<br>
-<br>
-               glGetProgramInfoLog(prog, size, NULL, info);<br>
+               prog_err_info = malloc(size);<br>
<br>
-               fprintf(stderr, "Failed to link:\n%s\n",<br>
-                       info);<br>
+               glGetProgramInfoLog(prog, size, NULL, prog_err_info);<br>
<br>
-               free(info);<br>
-               piglit_report_result(PIGLIT_FAIL);<br>
+               return;<br>
        }<br>
<br>
        glUseProgram(prog);<br>
<br>
        err = glGetError();<br>
-       if (err) {<br>
-               GLchar *info;<br>
+       if (!err) {<br>
+               prog_in_use = true;<br>
+       } else {<br>
                GLint size;<br>
<br>
-               printf("GL error after linking program: 0x%04x\n", err);<br>
-<br>
                glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);<br>
-               info = malloc(size);<br>
-<br>
-               glGetProgramInfoLog(prog, size, NULL, info);<br>
-               fprintf(stderr, "Info log: %s\n", info);<br>
+               prog_err_info = malloc(size);<br>
<br>
-               piglit_report_result(PIGLIT_FAIL);<br>
+               glGetProgramInfoLog(prog, size, NULL, prog_err_info);<br>
        }<br>
 }<br>
<br>
@@ -1638,6 +1636,19 @@ setup_ubos()<br>
        }<br>
 }<br>
<br>
+void<br>
+program_must_be_in_use(void)<br>
+{<br>
+       if (!link_ok) {<br>
+               fprintf(stderr, "Failed to link:\n%s\n", prog_err_info);<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       } else if (!prog_in_use) {<br>
+               fprintf(stderr, "Failed to use shader: %s\n", prog_err_info);<br></blockquote><div><br></div><div>I think "Failed to use program" would be a clearer error message here.  "Shader" generally refers to the things that are present prior to linking.<br>
<br></div><div>With that change, this patch is:<br><br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>> <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+}<br>
+<br>
 enum piglit_result<br>
 piglit_display(void)<br>
 {<br>
@@ -1648,6 +1659,7 @@ piglit_display(void)<br>
        if (test_start == NULL)<br>
                return PIGLIT_PASS;<br>
<br>
+       program_must_be_in_use();<br>
<br>
        line = test_start;<br>
        while (line[0] != '\0') {<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.10.4<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>