[Piglit] [PATCH] Only test non-default swap_interval if supported.

Jamey Sharp jamey at minilop.net
Fri Apr 18 12:27:38 PDT 2014


If this test is compiled on a machine that does not have headers for
GLX_MESA_swap_control, then it should skip any tests that require using
GLX_MESA_swap_control.

I tested this patch in both configurations, using "#if 0 && ..." to
check the unsupported-at-build-time case.

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
 tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c b/tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c
index 92f34ea..2f31fbf 100644
--- a/tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c
+++ b/tests/spec/glx_oml_sync_control/swapbuffersmsc-return.c
@@ -51,8 +51,8 @@ draw(Display *dpy)
 	bool pass = true;
 	int i;
 
-#if defined(GLX_MESA_swap_control)
 	if (swap_interval != -1) {
+#if defined(GLX_MESA_swap_control)
 		PFNGLXSWAPINTERVALMESAPROC pglXSwapIntervalMESA;
 
 		printf("Testing with swap interval %d\n", swap_interval);
@@ -62,12 +62,15 @@ draw(Display *dpy)
 			glXGetProcAddressARB((const GLubyte *)
 					     "glXSwapIntervalMESA");
 		pglXSwapIntervalMESA(swap_interval);
+#else
+		fprintf(stderr,
+			"Testing swap interval %d requires building with GLX_MESA_swap_control\n",
+			swap_interval);
+		piglit_report_result(PIGLIT_SKIP);
+#endif
 	} else {
 		printf("Testing with default swap interval\n");
 	}
-#else
-	printf("Testing with default swap interval\n");
-#endif
 
 	glXGetSyncValuesOML(dpy, win, &start_ust, &start_msc, &start_sbc);
 	if (start_sbc != 0) {
-- 
1.8.5.3



More information about the Piglit mailing list