summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2018-04-25 12:13:01 -0400
committerAdam Jackson <ajax@redhat.com>2018-04-30 14:12:43 -0400
commit43ac91170d61514ab1dd156a4373664b961d81d3 (patch)
treed44a974fe316a1f14770913be43198a82ec5330d /test
parent610203a1a4ce5709191a08572709e6a691e6b928 (diff)
downloadlibepoxy-43ac91170d61514ab1dd156a4373664b961d81d3.tar.gz
test/glx_public_api_core: Fail softer if core contexts aren't available
If you've built Mesa with --disable-texture-float, and try to run the tests against Xvfb, glx_public_api_core will fail: creating a direct context with llvmpipe will fail because you don't have ARB_texture_float, and the internal fallback to an indirect context will fail because indirect only supports through 1.4. So the server will throw GLXBadFBConfig at you to say "I don't support core contexts", which we should interpret as a skip not a failure. Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/glx_public_api_core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/glx_public_api_core.c b/test/glx_public_api_core.c
index 83b9689..f5a4f04 100644
--- a/test/glx_public_api_core.c
+++ b/test/glx_public_api_core.c
@@ -131,6 +131,12 @@ test_glx_version(void)
return true;
}
+static int
+error_handler(Display *d, XErrorEvent *ev)
+{
+ return 0;
+}
+
int
main(int argc, char **argv)
{
@@ -148,6 +154,7 @@ main(int argc, char **argv)
None
};
GLXContext ctx;
+ int (*old_handler)(Display *, XErrorEvent *);
dpy = get_display_or_skip();
@@ -157,9 +164,12 @@ main(int argc, char **argv)
visinfo = get_glx_visual(dpy);
win = get_glx_window(dpy, visinfo, false);
config = get_fbconfig_for_visinfo(dpy, visinfo);
+
+ old_handler = XSetErrorHandler(error_handler);
ctx = glXCreateContextAttribsARB(dpy, config, NULL, True, attribs);
if (ctx == None)
errx(77, "glXCreateContext failed");
+ XSetErrorHandler(old_handler);
glXMakeCurrent(dpy, win, ctx);