[Piglit] [PATCH] Add PIGLIT_FORCE_WINDOW environment variable.

Paul Berry stereotype441 at gmail.com
Fri Aug 9 11:44:40 PDT 2013


Setting PIGLIT_FORCE_WINDOW=1 causes all piglit windowsystem tests
(those that weren't invoked with the "-fbo" flag) to show the window
prior to calling piglit_display().  Setting PIGLIT_FORCE_WINDOW=0 (the
default) preserves piglit's existing behaviour, which is to only show
the window when the test is run in "manual" mode (with no "-auto"
argument supplied).

Setting PIGLIT_FORCE_WINDOW=1 slows down the piglit run, and produces
more annoying windows on the screen, but it has been observed to
produce more repeatable results when testing with the nVidia
proprietary driver for Linux.
---
 .../util/piglit-framework-gl/piglit_winsys_framework.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
index 509b4e0..7aff1ae 100644
--- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
@@ -50,11 +50,27 @@ run_test(struct piglit_gl_framework *gl_fw,
          int argc, char *argv[])
 {
 	struct piglit_winsys_framework *winsys_fw = piglit_winsys_framework(gl_fw);
+	bool force_window = false;
+	const char *env_force_window = getenv("PIGLIT_FORCE_WINDOW");
+
+
+	if (env_force_window != NULL) {
+		if (strcmp(env_force_window, "0") == 0) {
+			force_window = false;
+		} else if (strcmp(env_force_window, "1") == 0) {
+			force_window = true;
+		} else {
+			fprintf(stderr, "PIGLIT_FORCE_WINDOW has invalid"
+				" value: %s\n", env_force_window);
+			abort();
+		}
+	}
 
 	if (gl_fw->test_config->init)
 		gl_fw->test_config->init(argc, argv);
 
-	if (!gl_fw->test_config->requires_displayed_window && piglit_automatic) {
+	if (!gl_fw->test_config->requires_displayed_window &&
+	    piglit_automatic && !force_window) {
 		enum piglit_result result = PIGLIT_PASS;
 		if (gl_fw->test_config->display)
 			result = gl_fw->test_config->display();
-- 
1.8.3.4



More information about the Piglit mailing list