[Piglit] [PATCH] teximage-colors: replace assertion with useful info

Brian Paul brianp at vmware.com
Tue Sep 1 07:16:01 PDT 2015


Instead of asserting or crashing on a bad command line format, print
list of legal values.
---
 tests/texturing/teximage-colors.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/texturing/teximage-colors.c b/tests/texturing/teximage-colors.c
index ea0c5e1..bdd261b 100644
--- a/tests/texturing/teximage-colors.c
+++ b/tests/texturing/teximage-colors.c
@@ -486,7 +486,14 @@ piglit_init(int argc, char **argv)
 
 	piglit_require_extension("GL_EXT_texture_integer");
 
-	assert(format);
+	if (format == NULL) {
+		int i;
+		printf("Invalid format.  Valid formats:\n");
+
+		for (i = 0; i < ARRAY_LENGTH(formats); i++)
+			printf("  %s\n", formats[i].name);
+		exit(1);
+	}
 
 	signed_prog = piglit_build_simple_program(NULL, frag_shader_signed_src);
 	unsigned_prog = piglit_build_simple_program(NULL, frag_shader_unsigned_src);
-- 
1.9.1



More information about the Piglit mailing list