[Piglit] [PATCH 09/20] fbo: Make an alternate function for initializing fbo-formats.h.

Paul Berry stereotype441 at gmail.com
Tue Jun 5 17:03:19 PDT 2012


This patch extracts code from fbo_formats_init() into a separate
function, fbo_formats_init_test_set(), which skips command line
parsing and simply initializes fbo-formats.h to use a particular test
set.  This will allow future tests to make use of fbo-formats.h even
if they have to use different command-line parsing than what is
implemented in fbo_formats_init().

In addition, fbo_formats_init() has been changed to a non-static
function, so that if an fbo test directly calls
fbo_formats_init_test_set() instead, we won't get a spurious compile
warning about an unused function.
---
 tests/fbo/fbo-formats.h |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tests/fbo/fbo-formats.h b/tests/fbo/fbo-formats.h
index 8275c39..02bbfc7 100644
--- a/tests/fbo/fbo-formats.h
+++ b/tests/fbo/fbo-formats.h
@@ -568,7 +568,8 @@ fbo_lookup_test_set(const char *test_set_name)
 	exit(1);
 }
 
-static void fbo_formats_init(int argc, char **argv, GLboolean print_options)
+static void
+fbo_formats_init_test_set(int test_set_index, GLboolean print_options)
 {
 	if (!piglit_automatic)
 		glutKeyboardFunc(fbo_formats_key_func);
@@ -576,12 +577,7 @@ static void fbo_formats_init(int argc, char **argv, GLboolean print_options)
 	piglit_require_extension("GL_EXT_framebuffer_object");
 	piglit_require_extension("GL_ARB_texture_env_combine");
 
-	if (argc == 2) {
-		test_index = fbo_lookup_test_set(argv[1]);
-	} else if (argc > 2) {
-		printf("More than 1 test set specified\n");
-		exit(1);
-	}
+	test_index = test_set_index;
 
 	if (!piglit_automatic && print_options) {
 		printf("    -n   Next test set.\n"
@@ -593,6 +589,20 @@ static void fbo_formats_init(int argc, char **argv, GLboolean print_options)
 	printf("Using test set: %s\n", test_sets[test_index].param);
 }
 
+void
+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]);
+	} else if (argc > 2) {
+		printf("More than 1 test set specified\n");
+		exit(1);
+	}
+
+	fbo_formats_init_test_set(test_set_index, print_options);
+}
+
 static void add_result(bool *all_skip, enum piglit_result *end_result,
 		       enum piglit_result new_result)
 {
-- 
1.7.7.6



More information about the Piglit mailing list