Commit Graph
103 Commits
Author SHA1 Message Date
Eric Anholt e94a0816d7 test: Add unit tests for epoxy_gl_version() and epoxy_glsl_version().
Based on a bug report I got on IRC.

v2: Drop glx includes, add to automake.
2018-11-01 13:26:32 -07:00
Emmanuele Bassi 49bec45b28 Merge pull request #182 from anholt/issue-181
Define _GNU_SOURCE for strdup()
2018-06-18 09:57:21 +01:00
Emmanuele Bassi 7f38b12881 Define _GNU_SOURCE for strdup()
The strdup() function is available on uClibc if _XOPEN_SOURCE_EXTENDED
is defined; since we're using _GNU_SOURCE elsewhere to enable extended
libc features, and uClibc will set _XOPEN_SOURCE_EXTENDED if _GNU_SOURCE
is set, let's use that.

Closes #181
2018-06-18 09:15:03 +01:00
Emmanuele Bassi b3f67d47bd Add a CGL test for the Epoxy API
Just like the one we use for EGL.
2018-06-04 12:31:13 +01:00
Emmanuele Bassi 7e4b490ce7 Add a CoreGraphics OpenGL test for macOS
A basic test, to check that we're actually capable of working on macOS
without GLX enabled.
2018-06-04 12:30:11 +01:00
Ting-Wei Lan 27b0746940 dlwrap: Add FBSD_1.0 version for FreeBSD
This fixes dlwrap_real_dlsym on FreeBSD, but tests still fail because we
currently don't have libglvnd.
2018-05-05 00:00:55 +08:00
Ting-Wei Lan 5dc0c147e9 meson: Don't define _POSIX_C_SOURCE when dlvsym is found
FreeBSD hides declarations of non-POSIX functions when POSIX macros,
such as _POSIX_C_SOURCE or _XOPEN_SOURCE, is defined. This causes
test/dlwrap.c to fail to compile because it uses dlvsym and asprintf.

Fixes: #169
2018-05-04 23:50:36 +08:00
Adam Jackson 43ac91170d 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 <[email protected]>
2018-04-30 14:12:43 -04:00
Emmanuele Bassi 5fa7bf6e27 Remove the "EGL/GLX have different pointers" tests
The correct answer for systems with different EGL and GLX driver
implementations is to use GLVND.`

Closes #165
2018-04-12 16:42:06 +01:00
Ross Burton f9098b0c18 autotools: check for dlvsym
As per the previous commit, instead of assuming that Apple doesn't have dlvsym
but everywhere else does, actually check for dlvsym() existing as that function
is glibc-specific.
2018-03-12 12:02:08 +00:00
Ross Burton 1267f82021 meson: generalise build_apple to has_dlvsym
build_apple was introduced in 756dca as a proxy for the fact that Apple's libc
doesn't have dlvsym(), which is glibc-specific so also isn't present in other
libc implementations such as musl.

Instead of detecting whether we are building for Apple or not, just probe the to
see if we have dlvsym.
2018-03-12 12:02:08 +00:00
Jan Alexander Steffens (heftig) 6c6fcd3b12 test: Avoid egl_without_glx crash on NVIDIA
The NVIDIA driver calls dlopen with NULL as filename; strcmp is not
NULL-safe.
2018-03-08 17:16:29 -05:00
Emmanuele Bassi 28ca626eda tests: Add EGL test for Epoxy API
We have a few public entry points that we ought to test properly.

Using the EGL API is easier to set up a test case, so let's just do
that.
2018-02-24 14:09:37 +00:00
Emmanuele Bassi ce8cbdbe06 Allow building Epoxy without X11
Epoxy can be compiled with GLX and X11 native resources on EGL. We can
disable the former, but the latter is always built in when enabling EGL
support.

Some platforms do not support X11 at all, so we need a way to disable
X11 when configuring Epoxy.
2018-02-23 16:05:50 +00:00
Emmanuele Bassi 69c80df5ef Include Xlib.h when using Xlib API
The common EGL testing code uses XOpenDisplay(), which means we need to
explicitly include the Xlib.h header file, instead of relying on
something else stringing it along.
2018-02-23 10:56:36 +00:00
Emmanuele Bassi 64fc3ac7ce Merge pull request #143 from ikeydoherty/comp-warnings
Fix printf family usage
2018-02-23 09:36:30 +00:00
Michał Górny 3b3ff242de test: Fix respecting $(DLOPEN_LIBS)
Fix two tests that are linking to -ldl directly to use DLOPEN_LIBS. This
fixes failing test build on Gentoo/FreeBSD.
2018-02-22 19:58:40 +01:00
Adam Jackson 237a491b01 test: Fix dlwrap for glvnd
Add libOpenGL to the list of libraries we'll intercept. This is harmless
if glvnd is not available as the dlopen(libOpenGL.so) will fail, but
without this we can't intercept glGetString, which the
egl_and_glx_different_pointers_glx test needs to be able to do.

Signed-off-by: Adam Jackson <[email protected]>
2018-02-07 12:29:12 -05:00
Ikey Doherty c8d7ae6bf8 Only use printf family when passing arguments
This avoids any unnecessary allocations when simply passing static strings
to be printed onto stderr, and uses the simpler fputs mechanism.

Signed-off-by: Ikey Doherty <[email protected]>
2017-10-19 16:04:11 +01:00
Ikey Doherty 9dde80065f test: Fix trivial compiler warning in dlwrap
This mutes compiler warnings for `dlwrap.c` by ensuring we actually check
the return status of the `asprintf` call. At this point in the test suite
our possible failure here is only memory, so we'll abort.

Signed-off-by: Ikey Doherty <[email protected]>
2017-10-19 15:52:01 +01:00
Efraim Flashner ef1bb66402 test: Fix dlwrap on aarch64
dlsym on aarch64 has version GLIBC_2.17.
2017-03-19 11:01:42 +02:00
Emmanuele Bassi 2432daf4cf Drop unnecessary inclusion of "config.h"
The WGL tests should not include "config.h", since we're trying to test
the use of Epoxy, not its internals.
2017-02-08 17:52:32 +00:00
Emmanuele Bassi 2b6f01b008 Allow enabling and disabling GLX support, part II
After doing this for Meson in commit fc014fa1, let's do the same dance
for the Autotools build.
2017-02-06 15:58:20 +00:00
Emmanuele Bassi 476851ba41 Allow enabling and disabling GLX support
Currently, GLX support in libepoxy at build time is hard coded, but
various platforms have expressed their preference for having a
configure-time option for it.

For instance:

 - various embedded distributors do not ship with X11, but wish to use
   libraries that depend on libepoxy now that Wayland is available
 - distributors for macOS still wish to retain the ability to ship
   their software with X11 enabled

By default, we want epoxy to build with GLX enabled pretty much
everywhere it makes sense, since it's only a build-time option and it's
not a run-time dependency.
2017-02-06 13:48:53 +00:00
Emmanuele Bassi 59318edf64 build: Rework the build rules for generated files in Meson
Instead of using a generator and having to deal with tweaking the
inclusion paths, we can use a custom target rule, which will do the
right thing and put the generate files where we expect them to be.

Due to how Meson and Ninja work we need to be a bit more careful as to
how we deal with dependencies and generated files, especially since
Epoxy is built on the assumption that the only inclusion path for the
headers lies under the 'include' sub-directory.

First of all, we need to split the dispatch table generation into two
separate steps, one for the headers and one for the source files.

Additionally, we need to munge the paths of the non-generated headers
so that we reference them by their correct path.

These changes are necessary to ensure that Epoxy can be built on a
system without Epoxy installed already; the previous Meson-based build
system relied on the headers being installed in a system directory.
2017-01-25 12:36:20 +00:00
Emmanuele Bassi 08cc4d021d build: Add Meson build files
Meson is a Python-based build system that generates build rules of
Ninja, Visual Studio, and XCode. It's designed to be fast, and have a
small, non-Turing complete language to describe the build process,
tests, and dependencies. It's simpler than CMake, and faster than
autotools.

As a direct comparison in terms of speed, three build and check runs for
libepoxy from a clean Git repository clone yield these results on my
Kabylake Core i7 7500U (nproc=4):

- Autotools (make)
Run #1 (cold)   real: 22.384s, user: 20.011s, sys: 3.689s
Run #2 (warm)   real: 22.429s, user: 20.220s, sys: 3.708s
Run #3 (warm)   real: 22.068s, user: 19.743s, sys: 3.594s

- Meson (ninja)
Run #1 (cold)   real: 5.932s, user:  9.371s, sys: 1.625s
Run #2 (warm)   real: 6.273s, user: 10.066,  sys: 1.740s
Run #3 (warm)   real: 5.796s, user:  9.233s, sys: 1.607s

Which means that Meson and ninja are approximately 4x faster than
autotools.

In terms of simplicity, the autotools build takes six files and a total
of 645 lines; Meson requires 3 files, and 361 lines to achieve the same
result. Additionally, Meson automatically builds in a separate build
directory and does not leave files inside the source directory; and Meson
does not use libtool.

Since Meson is quite new and still actively developed, we're going to
leave the autotools build in place for a while, with the intention of
switching to Meson in the future.
2017-01-25 12:36:20 +00:00
Emmanuele Bassi 4fe238e023 tests/wgl: Use the right array offsets
And avoid an out of bounds access warning.
2017-01-25 12:28:29 +00:00
Emmanuele Bassi 6b68ddeaa0 build: Skip GLESv1 tests if there's no GLESv1
It's pretty much pointless to build and run tests for a library that we
know is not available.

The Meson build already skips the GLES 1.0 test, so let's make the
Autotools build do the same.
2017-01-25 12:28:29 +00:00
Adam Jackson 2aec628eb0 test: Fix dlwrap on ppc64 and s390x
These have dlsym versions of GLIBC_2.3 and GLIBC_2.2, respectively.

Signed-off-by: Adam Jackson <[email protected]>
2017-01-25 12:28:29 +00:00
Olivier Blin f62c9d92d0 dlwrap: add GLIBC_2.4 version to be able to run tests from ARM
See sysdeps/unix/sysv/linux/arm/libdl.abilist in glibc

Signed-off-by: Emmanuele Bassi <[email protected]>
2016-12-07 15:09:02 +00:00
Emmanuele Bassi 8dead45cb3 Revert all changes since 8bbc0d40
Most of the changes that happened after commit 8bbc0d40 broke epoxy
pretty much irreparably because of the CMake build and the attempt at
making libepoxy a static library that can be copy-pasted into another
project without generating files.

Since all the commits are entangled, and are full of unrelated changes,
we cannot simply do a localized set of reverts; instead, we need to hit
the reset button.

From this point forward, we're going to improve libepoxy's build while
attempting to keep the existing build system working. This may mean
reinstating the CMake build system at a later date.
2016-12-07 14:45:14 +00:00
Emmanuele Bassi d5dfe2bd96 build: Drop autogenerated autotools files from Git
These files should not be under revision control.

This commit partially reverts:

  * 06fd4a271a
  * 62e384129b
2016-11-07 20:20:04 +00:00
Yaron Cohen-Tal c342cba2a1 Add glibc versions 2.2 and 2.3 to "dlwrap_real_dlsym". 2015-11-05 17:51:01 +02:00
Yaron Cohen-Tal 2bf2468502 Merge branch "blino/master". 2015-09-21 14:15:44 +03:00
Olivier Blin fe7a96e077 dlwrap: add GLIBC_2.4 version to be able to run tests from ARM
See sysdeps/unix/sysv/linux/arm/libdl.abilist in glibc
2015-09-21 13:05:33 +02:00
Yaron Cohen-Tal 2af1715fbf Fix "FindGLESv1.cmake" and "FindGLESv2.cmake". 2015-09-04 12:51:13 +03:00
Yaron Cohen-Tal 44d51f2844 Fix support for a static build of Epoxy. Add support building and running tests with CMake. Add support for linking with the static run-time library with MSVC. 2015-09-03 23:17:39 +03:00
Yaron Cohen-Tal 62e384129b Add some files to the repo so that it's possible to build without running "autogen.sh". 2015-08-26 22:08:16 +03:00
Yaron Cohen-Tal 540952010b Fix tests to work with some OpenGL ES / EGL implementations. 2015-08-24 12:36:35 +03:00
Yaron Cohen-Tal 773dd02f59 Added makefiles to build with MSVC 2013, and fixed errors and warnings. 2015-07-18 17:39:12 +03:00
Eric Anholt 8bbc0d40c6 Make the glx_alias_prefer_same_name test work, and hook it up.
Apparently I started writing it, and didn't notice I wasn't building
my code when I committed the library support.
2015-07-16 11:24:34 -07:00
Chun-wei Fan a2a51904b0 test/wgl_per_context_funcptrs.c: Fix build on Visual Studio
Ensure that we do __stdcall only after the return type, as Visual Studio
will not like it otherwise.
2015-06-05 17:51:39 -07:00
Eric Anholt b2ae054b3a Avoid name conflicts between pkgconfig's EGL_LIBS and a temporary var.
I felt a little uncomfortable knowing I had two things defining
EGL_LIBS, but it worked on my system.  It failed on the travis ci
build.
2014-06-13 15:57:11 -07:00
Eric Anholt d56f21c494 Use the EGL pkgconfig for finding eglplatform.h.
We don't ever explicity link against libEGL, so no need to make use of
EGL_LIBS.

Fixes #30.
2014-06-13 14:59:37 -07:00
Eric Anholt 27298ee31b tests: Fix the passing of the "-z now" arg to the linker.
These LDFLAGS go to the compiler, and getting the arg to the linker
requires -Wl or -Xlinker.  gcc apparently was passing this through
anyway, while clang was getting angry.
2014-06-13 14:44:54 -07:00
Eric Anholt 6eb075c70e Fix EGL context detection for non-GLES2-core functions.
Fixes failure of the X Server with glamor using desktop GL on EGL, and
the associated testcase in the tree.  This was clearly just
copy-and-paste failure on my part in
b251e3ae33.
2014-04-08 23:54:26 -07:00
Eric Anholt bb94003b78 Add a test for a failure I found with the X Server after my last fixes. 2014-04-08 23:54:25 -07:00
Eric Anholt 756dcaf6a5 Disable the dlwrap-based tests on apple.
We'd need a dlvsym() equivalent.
2014-03-28 16:45:26 -07:00
Eric Anholt 11a946cbf5 Prefer non-aliased functions when resolving.
This increases the size of the library, but avoids some of the
concerns that have been brought up with the library silently switching
you from glWhateverEXT() to glWhatever() if there might be slight
behavior differences between the two that hadn't been identified.  The
downside is that it means we can't share the resolver functions among aliases.
2014-03-28 16:33:53 -07:00
Eric Anholt ea12f935c1 wgl: Add a test for MakeCurrent returning different function pointers.
Huh, my old rule of "untested code is broken code" didn't hold up, for once.
2014-03-28 16:33:19 -07:00