On 17 February 2013 10:31, Jordan Justen <[email protected]> wrote:
> To prepare for supporting negative linker tests. > > Signed-off-by: Jordan Justen <[email protected]> > --- > tests/shaders/shader_runner.c | 48 > +++++++++++++++++++++++++---------------- > 1 file changed, 30 insertions(+), 18 deletions(-) > > diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c > index eae5063..2293b9e 100644 > --- a/tests/shaders/shader_runner.c > +++ b/tests/shaders/shader_runner.c > @@ -97,6 +97,9 @@ const char *vertex_data_start = NULL; > const char *vertex_data_end = NULL; > GLuint prog; > size_t num_vbo_rows = 0; > +bool link_ok = false; > +bool prog_in_use = false; > +GLchar *prog_err_info = NULL; > > enum states { > none = 0, > @@ -319,6 +322,8 @@ compile_and_bind_program(GLenum target, const char > *start, int len) > > glEnable(target); > glBindProgramARB(target, prog); > + link_ok = true; > + prog_in_use = true; > } > > /** > @@ -789,38 +794,31 @@ link_and_use_shaders(void) > } > > glGetProgramiv(prog, GL_LINK_STATUS, &ok); > - if (!ok) { > - GLchar *info; > + if (ok) { > + link_ok = true; > + } else { > GLint size; > > glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); > - info = malloc(size); > - > - glGetProgramInfoLog(prog, size, NULL, info); > + prog_err_info = malloc(size); > > - fprintf(stderr, "Failed to link:\n%s\n", > - info); > + glGetProgramInfoLog(prog, size, NULL, prog_err_info); > > - free(info); > - piglit_report_result(PIGLIT_FAIL); > + return; > } > > glUseProgram(prog); > > err = glGetError(); > - if (err) { > - GLchar *info; > + if (!err) { > + prog_in_use = true; > + } else { > GLint size; > > - printf("GL error after linking program: 0x%04x\n", err); > - > glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); > - info = malloc(size); > - > - glGetProgramInfoLog(prog, size, NULL, info); > - fprintf(stderr, "Info log: %s\n", info); > + prog_err_info = malloc(size); > > - piglit_report_result(PIGLIT_FAIL); > + glGetProgramInfoLog(prog, size, NULL, prog_err_info); > } > } > > @@ -1638,6 +1636,19 @@ setup_ubos() > } > } > > +void > +program_must_be_in_use(void) > +{ > + if (!link_ok) { > + fprintf(stderr, "Failed to link:\n%s\n", prog_err_info); > + piglit_report_result(PIGLIT_FAIL); > + } else if (!prog_in_use) { > + fprintf(stderr, "Failed to use shader: %s\n", > prog_err_info); > 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. With that change, this patch is: Reviewed-by: Paul Berry <[email protected]> > + piglit_report_result(PIGLIT_FAIL); > + } > + > +} > + > enum piglit_result > piglit_display(void) > { > @@ -1648,6 +1659,7 @@ piglit_display(void) > if (test_start == NULL) > return PIGLIT_PASS; > > + program_must_be_in_use(); > > line = test_start; > while (line[0] != '\0') { > -- > 1.7.10.4 > > _______________________________________________ > Piglit mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/piglit >
_______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
