testglxgetprocaddress: Use a valid display connection.

The test function in testglxgetprocaddress uses a display and screen number to
figure out which vendor to dispatch to, so it needs a real, valid display
connection.

Fixes issue #32.
This commit is contained in:
Kyle Brenneman 2015-05-11 17:27:40 -06:00
parent afda2e2489
commit 42f160579c
2 changed files with 11 additions and 2 deletions

View file

@ -107,7 +107,8 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/util/glvnd_pthread
testglxgetprocaddress_LDADD = $(top_builddir)/src/GLX/libGLX.la
testglxgetprocaddress_LDADD = -lX11
testglxgetprocaddress_LDADD += $(top_builddir)/src/GLX/libGLX.la
testglxmakecurrent_LDADD = -lX11
testglxmakecurrent_LDADD += $(top_builddir)/src/GLX/libGLX.la

View file

@ -65,6 +65,8 @@ PROC_DEFINES(void, OogaBooga, (int a, int b, int c));
int main(int argc, char **argv)
{
Display *dpy = NULL;
int retval = 0;
/*
* Try GetProcAddress on different classes of API functions, and bogus
@ -73,6 +75,12 @@ int main(int argc, char **argv)
* to no-ops.
*/
dpy = XOpenDisplay(NULL);
if (dpy == NULL) {
printf("Can't open display\n");
goto fail;
}
/*
* Test core GLX dispatch functions implemented by API library. This
* simply returns the symbol exported by libGLX.
@ -87,7 +95,7 @@ int main(int argc, char **argv)
* (a zero value indicates we might be calling into a no-op stub generated
* by libGLdispatch).
*/
CHECK_PROC(glXExampleExtensionFunction, (NULL, 0, &retval));
CHECK_PROC(glXExampleExtensionFunction, (dpy, DefaultScreen(dpy), &retval));
if (!retval) {
printf("Unexpected glXExampleExtensionFunction() return value!\n");