[Piglit] [PATCH 1/4] glslparsertest: Add diagnostic messages for when tests are skipped
Ian Romanick
idr at freedesktop.org
Mon Oct 11 17:44:21 PDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chad Versace wrote:
> From: Chad Versace <chad.versace at intel.com>
>
> When glslparsertest skips a test, it now emits a message explaining why the
> test is skipped.
> ---
> tests/glslparsertest/glslparsertest.c | 30 +++++++++++++++++++++++-------
> 1 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c
> index 6b4f409..3cd76eb 100644
> --- a/tests/glslparsertest/glslparsertest.c
> +++ b/tests/glslparsertest/glslparsertest.c
> @@ -62,35 +62,47 @@ test(void)
> else if (strcmp(filename + strlen(filename) - 4, "vert") == 0)
> type = GL_VERTEX_SHADER;
> else {
> - fprintf(stderr, "Couldn't determine type of program %s\n",
> + fprintf(stdout, "Couldn't determine type of program %s\n",
> filename);
> piglit_report_result(PIGLIT_FAILURE);
> exit(1);
> }
>
> if (!GLEW_VERSION_2_0) {
> - if (type == GL_FRAGMENT_SHADER && !GLEW_ARB_fragment_shader)
> + if (type == GL_FRAGMENT_SHADER && !GLEW_ARB_fragment_shader) {
> + fprintf(stderr,
> + "Skipped because these conditions are true:\n"
> + " - GLEW version != 2.0\n"
> + " - Shader type is GL_FRAGMENT_SHADER\n"
> + " - Extension GLEW_ARB_fragment_shader is unsupported\n");
Mentioning GLEW here means nothing to the user. A more concise message
of "Test requires OpenGL 2.0 or GL_ARB_fragment_shader" is better.
> piglit_report_result(PIGLIT_SKIP);
> - if (type == GL_VERTEX_SHADER && !GLEW_ARB_vertex_shader)
> + }
> + if (type == GL_VERTEX_SHADER && !GLEW_ARB_vertex_shader) {
> + fprintf(stderr,
> + "Skipped because these conditions are true:\n"
> + " - GLEW version != 2.0\n"
> + " - Shader type is GL_VERTEX_SHADER\n"
> + " - Extension GLEW_ARB_vertex_shader is unsupported\n");
Same here.
> piglit_report_result(PIGLIT_SKIP);
> + }
> }
>
> err = stat(filename, &st);
> if (err == -1) {
> - fprintf(stderr, "Couldn't stat program %s: %s\n",
> + fprintf(stdout, "Couldn't stat program %s: %s\n",
Why change to stdout?
> filename, strerror(errno));
> exit(1);
> }
>
> prog_string = malloc(st.st_size + 1);
> if (prog_string == NULL) {
> - fprintf(stderr, "malloc\n");
> + fprintf(stdout, "malloc\n");
> exit(1);
> }
>
> f = fopen(filename, "r");
> if (f == NULL) {
> - fprintf(stderr, "Couldn't open program %s: %s\n",
> + fprintf(stdout, "Couldn't open program %s: %s\n",
> filename, strerror(errno));
> exit(1);
> }
> @@ -200,7 +212,7 @@ int main(int argc, char**argv)
> glewInit();
>
> if (!GLEW_VERSION_2_0 && !GL_ARB_shader_objects) {
> - printf("Requires OpenGL 2.0\n");
> + fprintf(stderr, "Requires OpenGL 2.0\n");
> piglit_report_result(PIGLIT_SKIP);
> exit(1);
> }
> @@ -211,6 +223,10 @@ int main(int argc, char**argv)
> ? 0.0 : strtod(glsl_version_string, NULL);
>
> if (glsl_version < minimum_version) {
> + fprintf(stderr,
> + "GLSL version is %f, but minimum version %f is required\n",
> + glsl_version,
> + minimum_version);
> piglit_report_result(PIGLIT_SKIP);
> } else {
> test();
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkyzr2QACgkQX1gOwKyEAw/erwCfUzrDR5UaIX2DiTjCrNy04WoM
9coAoJfqa679U43Ds1pHaGiyzY9Ub+cy
=4QgS
-----END PGP SIGNATURE-----
More information about the Piglit
mailing list