[Piglit] [PATCH 1/3] fbo-formats: refactor fbo_lookup_test_set() / fbo_formats_init()
Brian Paul
brianp at vmware.com
Mon Feb 29 15:51:54 UTC 2016
Move the error message and exit() into the later.
---
tests/fbo/fbo-formats.h | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/fbo/fbo-formats.h b/tests/fbo/fbo-formats.h
index 42a12ea..f5e9150 100644
--- a/tests/fbo/fbo-formats.h
+++ b/tests/fbo/fbo-formats.h
@@ -601,6 +601,10 @@ static void fbo_formats_key_func(unsigned char key, int x, int y)
piglit_escape_exit_key(key, x, y);
}
+/**
+ * Look up a test set name (such as "GL_EXT_texture_sRGB").
+ * \return index >= 0 if found, -1 if not found
+ */
static int
fbo_lookup_test_set(const char *test_set_name)
{
@@ -618,8 +622,7 @@ fbo_lookup_test_set(const char *test_set_name)
}
}
- fprintf(stderr, "Unknown test set: %s\n", test_set_name);
- exit(1);
+ return -1;
}
static void
@@ -649,6 +652,10 @@ fbo_formats_init(int argc, char **argv, GLboolean print_options)
int test_set_index = 0;
if (argc == 2) {
test_set_index = fbo_lookup_test_set(argv[1]);
+ if (test_set_index < 0) {
+ fprintf(stderr, "Unknown test set: %s\n", argv[1]);
+ exit(1);
+ }
} else if (argc > 2) {
printf("More than 1 test set specified\n");
exit(1);
--
1.9.1
More information about the Piglit
mailing list