Commit graph

43 commits

Author SHA1 Message Date
Dylan Baker b308a876d3 autotools: Include meson.build and meson_options.txt in dist 2019-12-05 12:01:36 -08:00
Kyle Brenneman 84d4d6628b tests: Remove testpatchentrypoints
The testgldispatch tests cover the entrypoint patching code, so the
testpatchentrypoints test is redundant.
2019-11-14 08:34:50 -07:00
Kyle Brenneman 17ecd2f156 tests: Make the glXMakeCurrent tests work without assembly support.
Change glMakeCurrentTestResults to a GLX function instead of a GL function, so
that it can be dispatched using a vendor-provided stub instead of having to
generate one.

Remove the testglxmclate test, and the --late option in testglxmakecurrent,
since that only makes sense when MakeCurrentTestResults was a GL function.
2019-11-14 08:34:49 -07:00
Kyle Brenneman 4261cb96f6 tests: Rework testglxgetprocaddress.
It now calls glXGetClientString up front to load the dummy vendor library. The
GLX entrypoint generation path has its own test now, so this test can now work
on builds without assembly support.

It now uses glXQueryServerString to test calling a core GLX function. That's a
better test because it returns a predictable value, so we can make sure that it
actually gets dispatched to the vendor library, instead of just checking that
it doesn't crash.

For testing looking up an OpenGL function, it'll call glXGetProcAddress and
directly call __glDispatchGetProcAddress, and make sure that it gets the same
pointer from both. It doesn't try to call the function, since OpenGL
dispatching has its own tests.
2019-11-14 08:34:48 -07:00
Kyle Brenneman d1ce26f9a4 tests: Add a new test for GLX entrypoint generation.
Added a separate test program testglxgetprocaddress_genentry to test the GLX
entrypoint generation by itself instead of lumping that in with
testglxgetprocaddress.
2019-11-14 08:34:48 -07:00
Kyle Brenneman 8bb82da3fe tests: Add some threading tests for libGLdispatch.
Added a new test, testgldispatchthread, which tests some of the thread-handling
stuff in libGLdispatch.
2019-11-14 08:34:47 -07:00
Kyle Brenneman 68066ebc8e tests: Fix building the GLX tests.
Defining a target-specific CFLAGS variable overrides AM_CFLAGS, so add the same
include paths for the GLX tests that we used to add using AM_CFLAGS.

Also remove the -Wno-error flags, since they aren't needed anymore.
2019-09-12 12:19:32 -06:00
Kyle Brenneman e49caa311f Use the pkg-config variables for X11 and Xext.
In the makefiles, use the CFLAGS and LIBS variables set by the
PKG_CHECK_MODULES macros for X11 and Xext.
2019-09-12 10:15:33 -06:00
Kyle Brenneman c805774da2 tests: Add utils_misc to tests that need it.
src/util/trace.c calls glvnd_vasprintf, which is defined in
src/util/utils_misc.c, so any tests that use trace.c also need to
use utils_misc.c.
2019-07-31 09:54:00 -06:00
Kyle Brenneman bed48a107c tests: Add tests for the multithreaded path in libGLdispatch
This is important for testing the TSD stubs, which have a separate fast path
for single-threaded programs.

The TSD stubs start with a simple global variable to hold the dispatch table
so that a single-threaded program doesn't have to deal with the overhead of
calling pthread_getspecific. When a second thread comes along, it sets that
variable to NULL, which makes the stubs call pthread_getspecific instead.

This change adds a flag to the testgldispatch test program that tells it to
call into libGLdispatch from two threads to force it into its multi-threaded
mode.

It also adds three new test scripts, which are the same testgldispatch tests
but for the multithreaded path.
2018-09-20 10:22:19 -06:00
Kyle Brenneman 0177ade402 configure: Check if linking against libdl is necessary.
Add an AC_CHECK_FUNC call to check whether dlopen is available without any
additional libraries. Some systems provide dlopen as part of libc, in which
case we can't (and don't need to) link against libdl.so.
2018-03-26 14:41:01 -06:00
Kyle Brenneman f34d06facf tests: Add a test for creating GLX contexts.
Add a new test, testglxcreatecontext to test the various functions for creating
GLX contexts.

It tests the core GLX functions, the GLX_ARB_create_context and
GLX_EXT_no_config_context extensions, and using a vendor-provided extension
function.

The new test is much simpler than trying to use testglxmakecurrent to test both
context creation and MakeCurrent, especially for trying to test multiple
context creation functions.
2017-12-06 13:33:42 -07:00
Kyle Brenneman 8b7a44fb6d tests: Expand the unit tests for libGLdispatch.
Replaced testpatchentrypoints_gldispatch with three new unit tests.

testgldispatch_static and testgldispatch_generated test dispatching to multiple
vendor libraries through static and generated dispatch stubs, respectively.

testgldispatch_generated tests entrypoint patching and unpatching. This adds
coverage for patching generated stubs in addition to the static ones.

The entrypoint patching functions in tests/dummy/patchentrypoints.c now take
the name of the function to patch, instead of hard-coding it to only patch
glVertex3fv.
2017-02-28 16:37:36 -07:00
Kyle Brenneman ca0de36630 Add configure options for the EGL, GLX, and GLES libraries.
Added three new configure options to disable building the EGL, GLX, GLES
libraries.

In the tests makefile, move the list of test scripts to separate unconditional
variables, and add those to EXTRA_DIST. Just conditionally adding variables to
TESTS isn't enough to include the test scripts in the dist package.
2016-12-13 15:45:26 -07:00
Kyle Brenneman 152ba20ff1 tests: Clean up tests makefile.
Split up the TESTS and check_PROGRAMS variable assignments, so that they're
assigned next to the commands to build each test.

In addition to better readability and making it easier to avoid merge
conflicts, this will allow making some of the tests conditional based on build
options.
2016-12-13 15:36:31 -07:00
Kyle Brenneman 260a54606c tests: Add a test for EGL_KHR_debug. 2016-11-02 17:03:33 -06:00
Kyle Brenneman 359c99d547 tests: Add a test for eglGetError.
Add a test to check libEGL's error reporting, including errors reported by a
vendor library.
2016-11-02 17:03:31 -06:00
Kyle Brenneman b892485054 tests: Add a test for eglMakeCurrent.
Add a test for switching between different contexts across multiple vendors.
The new test also checks libEGL's recovery when a vendor's eglMakeCurrent
fails.

The EGL dummy vendor will now keep track of the current context, so that we
can test whether eglMakeCurrent calls get passed through correctly.

Also added a command to force an eglMakeCurrent call to fail, and to fetch the
the current context from directly from a vendor library.
2016-11-02 17:03:29 -06:00
Kyle Brenneman cd186e8479 tests: Add a test for EGL device functions.
Added a test for EGL_EXT_device_enumeration and EGL_EXT_platform_device, plus
dispatching to an EGL extesnion function based on an EGLDeviceEXT handle.
2016-11-02 17:03:27 -06:00
Kyle Brenneman 579e0acdb0 tests: Add a test for eglGetProcAddress.
Added a test for eglGetProcAddress and dispatching for EGL and GL functions.

Added three EGL extension functions to the EGL dummy vendor, to test
dispatching extensions by display, device, and current context.

Added a simple implementation of eglCreateContext, eglDestroyContext, and
eglMakeCurrent, and glGetString.
2016-11-02 17:03:18 -06:00
Kyle Brenneman 3e7bba599f tests: Add a basic test for eglGetPlatformDisplay.
Added two dummy libraries for EGL. They both use the same code, but each one
has a name string that can be used to check which vendor something is
dispatched to.

The dummy library is still incomplete, but more functions will be add later
along with more tests.

The test just creates an EGLDisplay using a dummy platform type, and then
checks to make sure that the display dispatches to the correct vendor library.

Also added a script to set up the test environment, and a file for common
functions and variables for EGL tests.
2016-11-02 16:37:55 -06:00
Kyle Brenneman 4546879413 tests: Remove init_test_env.sh and fini_test_env.sh.
Without the x11glvnd tests, nothing actually uses anything in the
init_test_env.sh and fini_test_env.sh scripts.
2016-10-31 16:15:29 -06:00
Kyle Brenneman dc95a0eec0 tests: Add a test for generated GLX entrypoints.
Added a variation of testglxgetprocaddress that doesn't pre-load the vendor
library. This forces it to generate a GLX entrypoint at runtime for
glXExampleExtensionFunction.

In testglxgetprocaddress.c, added a call to glXGetClientString so that it will
load the vendor library without having to pre-load it.
2016-10-18 13:46:18 -06:00
Kyle Brenneman a813b56339 tests: Add a more extensive test for entrypoint patching.
Add a new unit test, testpatchentrypoints_gldispatch. It calls into
libGLdispatch directly instead of going through GLX or EGL, and it tests
patching and unpatching between multiple vendor libraries.

Rewrote the x86-64 assembly for the entrypoint patching tests. It now uses
absolute memory addresses instead of RIP-relative, so it can work even if the
variable that it's supposed to update isn't within +-2GB of the function.
2016-10-17 11:12:21 -06:00
Kyle Brenneman 6bc8902de8 tests: Rename GLX_dummy directory.
Rename the GLX_dummy directory to just "dummy", since the code in it will be
used for non-GLX tests.
2016-10-17 11:12:21 -06:00
Kyle Brenneman fa6a74c03b tests: Some minor cleanup
Added a separate script glxenv.sh for the common environment variables used by
the other GLX tests.

Removed the testx11glvndproto and testglxnscreens tests, since both of them
depend on the x11glvnd X extension, which is no longer used.

Removed the unused GLX_dummy_copy stuff from the GLX_dummy makefile. Also
removed the COMMON_* variables, since they're only ever used once each.
2016-10-17 11:12:21 -06:00
Kyle Brenneman 87ce484d49 Move trace.[ch] into the src/utils directory.
Move trace.c and trace.h into the src/utils directory instead of a
subdirectory.
2016-04-06 11:00:32 -06:00
Kyle Brenneman d79a1484ac Fix some autoconf warnings.
Fixed a few order and variable name warnings.

Defined convenience libraries for the source files under src/util, to avoid the
subdir-objects warning from them.
2016-04-06 10:57:23 -06:00
Kyle Brenneman 1d7ab91b76 Remove the x11glvnd extension.
Delete the x11glvnd directory.

Commented out the two tests that depend on it, testx11glvndproto and
testglxnscreens. Eventually, they should be rewritten to use the
GLX_EXT_libglvnd extension instead.
2016-03-24 12:46:41 -06:00
Kyle Brenneman dcc1c9ca33 Remove the makefile for glvnd_pthread.
Moved glvnd_pthread.h and glvnd_pthread.c into src/utils, and removed the
separate makefile for them. The other makefiles now just grab the source file
directly instead.

Reviewed-by: Andy Ritger <aritger@nvidia.com>
2016-02-25 12:54:29 -07:00
Kyle Brenneman 42f160579c 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.
2015-05-12 11:45:02 -06:00
Adam Jackson 1503ec8ba7 tests: Don't force DISPLAY=:0, just inherit it from the environment
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-05-08 14:08:27 -04:00
Brian Nguyen 171fa7481f Add testpatchentrypoints unit test
This unit test verifies that entrypoint patching works as expected, by
loading libGLX_patchentry.so, looking up the address of
__glXSawVertex3fv defined in libGLX_patchentry.so, and verifying that
the value at this symbol matches the number of calls to glVertex3fv()
(which is hacked to increment __glXSawVertex3fv via entrypoint
rewriting).
2014-01-23 20:28:50 -08:00
Aaron Plattner 61360bc961 [build] distribute files needed to build
Everything needed to actually build the driver needs to be included in something
that makes it end up in the distribution tarball.  For headers, use
noinst_HEADERS.  For everything else, use EXTRA_DIST.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
2013-09-27 03:12:29 -07:00
Aaron Plattner 322c347a7d [build] fix more srcdir != builddir mistakes
I missed these in commit debae590e7 because my
test system had a compatible glxext.h in /usr/include/GL.  On a system with an
incompatible version (i.e. Ubuntu), this causes build failures.  Fix the include
paths to include the GL headers from the repository instead of the system.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
2013-09-26 23:00:34 -07:00
Andy Ritger 345a2f34ce Link libtrace.la *after* libglvnd_pthread.la
Debug builds of libglvnd_pthread.la depend on the __glvnd_dbg_printf
symbol from libtrace.la.  Sort the link order so that the linker sees
libglvnd_pthread.la and its unresolved symbol first, so that it knows
to resolve it when it subsequently sees libtrace.la.

Signed-off-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
2013-09-04 00:06:33 -07:00
Brian Nguyen 402e5a8a4c [tests] Add testx11glvndproto and testglxnscreens subtests
testx11glvndproto tests specifically the GLVendor X extension, which is
used to lookup XID -> screen and screen -> vendor mappings in the
prototype.

testglxnscreens tests that the API library successfully dispatches GL
calls to the right vendor based on this lookup.
2013-08-26 11:03:43 -07:00
Brian Nguyen 9eec93a6f8 [tests] Add testglxqueryversion subtest
This verifies that the GLX API library's hand-coded implementation
of glXQueryVersion() works as expected.
2013-08-26 11:03:43 -07:00
Brian Nguyen f3c6f65d36 [tests] Add testglxgetclientstr subtest
This subtest verifies that the GLX API library's implementation of
glXGetClientString() (which takes the "union" (concatenation) of each
vendor's client string) works as expected.
2013-08-26 11:03:43 -07:00
Brian Nguyen 67f04602e6 [tests] Add testglxmcoldlink subtest
This is a variant of the testglxmakecurrent subtest which links against
the libGL filter library instead of libOpenGL + libGLX. This verifies
the ELF symbol filtering works as expected.
2013-08-26 11:03:43 -07:00
Brian Nguyen 808706d3a2 [tests] Add make current subtests
This implements a test app, testglxmakecurrent, which verifies the
correctness of the API library's GL dispatching when a vendor's context
is current in one or more threads.

This test spawns a given number of threads each with their own separate
context and window, and has each thread make current to its given
context. The thread then calls some core GL functions and
(to-be-implemented) a GL extension function, glMakeCurrentTestResults(),
which returns the number of times each core GL function was called.
The test then compares glMakeCurrentTestResults()'s result (which should
match up with the vendor library's call count) to the application's call
count and fails if there is a mismatch.

The test is designed to only require pthreads if multiple threads are
used. This verifies that the API library's single-threaded fake pthread
wrapper functions work properly.

Add testglxmc{basic,late,loop,threads}.sh scripts, which run the
testglxmakecurrent test with different arguments for ordering of
glXGetProcAddress(), number of threads, and number of iterations.

Isolate helper functions for window creation/destruction to a separate
test_utils.c source file which will be used by later tests.
2013-08-26 11:03:43 -07:00
Brian Nguyen e0e68e14d4 [tests] Add testglxgetprocaddress subtest
This subtest verifies that glXGetProcAddress() works for the various
classifications of "GetProcAddress-able" functions:

- GLX 1.4 functions with dispatchers implemented directly by the API
  library
- GLX 1.4 extension functions with dispatchers implemented by a vendor
  loaded by the API library
- Core OpenGL functions with static dispatch stubs in libGLdispatch
- Core OpenGL functions with dynamic dispatch stubs generated by
  libGLdispatch

This also tests some assertions about these dispatch stubs; namely that
the core GL dispatch stubs are no-ops if no context is current.
2013-08-26 11:03:43 -07:00
Brian Nguyen 42589ec4c5 [tests] Add basic test infrastructure
This adds build infrastructure for unit testing the API library
using the serial test harness. TODO: this should be replaced with
the parallel test harness, as the automake documentation says the
serial harness is deprecated.

The first and last tests to be run are scripts to initialize the test
environment (an X session with a special -modulepath argument and
xorg.conf file to pick up x11glvnd) and tear it down after all unit
tests are run.

This also adds a placeholder directory for a fake vendor library
called "GLX_dummy", to be implemented later.
2013-08-26 11:03:43 -07:00