This patch has two components. 1. In tests/util/piglit-framework-gl.h, replace the definition of PIGLIT_GL_TEST_MAIN with the macro block PIGLIT_GL_CONFIG_BEGIN/END.
The macro PIGLIT_GL_TEST_MAIN was very restrictive. It was a fixed-arity macro function that allowed a test to set only set 3 values: window width, height, and visual. It would have been difficult to shoehorn optional test attributes into such a fixed-arity macro function. Allowing optional attributes is an essential feature because a following commit adds optional fields to struct piglit_gl_test_config. The macro block PIGLIT_GL_TEST_CONFIG_BEGIN/END is more flexible. Within it the test is allowed to arbitrarilty modify the piglit_gl_test_config structure. 2. In each GL test source, replace PIGLIT_GL_TEST_MAIN with a PIGLIT_GL_TEST_CONFIG_BEGIN/END block. Signed-off-by: Chad Versace <[email protected]> ==================================================================== This is a gian sed-job patch. Here is example diff for a test file. diff --git a/tests/asmparsertest/asmparsertest.c b/tests/asmparsertest/asmparsertest.c index e187603..b916555 100644 --- a/tests/asmparsertest/asmparsertest.c +++ b/tests/asmparsertest/asmparsertest.c @@ -30,10 +30,13 @@ #define TRUE (!FALSE) #endif -PIGLIT_GL_TEST_MAIN( - 250 /*window_width*/, - 250 /*window_height*/, - PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_DEPTH) +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.window_width = 250; + config.window_height = 250; + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_DEPTH; + +PIGLIT_GL_TEST_CONFIG_END char * unix_line_endings(const char *input, size_t length) ============================================================================= And here is the complete diff for tests/util. diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h index d4dd468..62883e4 100644 --- a/tests/util/piglit-framework-gl.h +++ b/tests/util/piglit-framework-gl.h @@ -105,13 +105,7 @@ piglit_gl_test_run(int argc, char *argv[], # define PIGLIT_EXTERN_C_END #endif -/** - * Define a boilerplate main() that should be suitable for most OpenGL test - * executables. - */ -#define PIGLIT_GL_TEST_MAIN(_window_width, \ - _window_height, \ - _window_visual) \ +#define PIGLIT_GL_TEST_CONFIG_BEGIN \ \ PIGLIT_EXTERN_C_BEGIN \ \ @@ -130,12 +124,10 @@ piglit_gl_test_run(int argc, char *argv[], \ piglit_gl_test_config_init(&config); \ \ - config.window_width = _window_width; \ - config.window_height = _window_height; \ - config.window_visual = _window_visual; \ - \ config.init = piglit_init; \ config.display = piglit_display; \ + +#define PIGLIT_GL_TEST_CONFIG_END \ \ piglit_gl_test_run(argc, argv, &config); \ \ -- 1.7.12.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
