summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2016-12-07 14:45:14 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2016-12-07 14:45:14 +0000
commit8dead45cb366bf5c08539bef2ccaa36b80eb1483 (patch)
tree25bdc2041b9d00d0e2e1e46ece0f96b8aaca0527 /test
parent0aa9d1bc831683bfe93980eb3cffa1f0c2f058fb (diff)
downloadlibepoxy-8dead45cb366bf5c08539bef2ccaa36b80eb1483.tar.gz
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.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt150
-rw-r--r--test/Makefile.sources73
-rw-r--r--test/Makefile.vc68
-rw-r--r--test/dlwrap.c3
-rw-r--r--test/egl_and_glx_different_pointers.c15
-rw-r--r--test/egl_common.c10
-rw-r--r--test/egl_common.h2
-rw-r--r--test/egl_gl.c11
-rw-r--r--test/egl_has_extension_nocontext.c5
-rw-r--r--test/egl_without_glx.c39
-rw-r--r--test/glx_alias_prefer_same_name.c5
-rw-r--r--test/glx_beginend.c3
-rw-r--r--test/glx_common.c4
-rw-r--r--test/glx_gles2.c4
-rw-r--r--test/glx_glxgetprocaddress_nocontext.c3
-rw-r--r--test/glx_has_extension_nocontext.c3
-rw-r--r--test/glx_public_api.c3
-rw-r--r--test/glx_public_api_core.c3
-rw-r--r--test/glx_static.c3
-rw-r--r--test/headerguards.c43
-rw-r--r--test/khronos_typedefs_nonepoxy.c19
-rw-r--r--test/miscdefines.c6
-rw-r--r--test/wgl_common.c4
-rw-r--r--test/wgl_core_and_exts.c4
-rw-r--r--test/wgl_per_context_funcptrs.c6
-rw-r--r--test/wgl_usefontbitmaps.c8
26 files changed, 131 insertions, 366 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
deleted file mode 100644
index f23e9e7..0000000
--- a/test/CMakeLists.txt
+++ /dev/null
@@ -1,150 +0,0 @@
-if (EPOXY_BUILD_TESTS)
-
- if (EPOXY_BUILD_SHARED)
- set (TESTS_TARGET_NAME "${EPOXY_TARGET_NAME}_shared")
- else ()
- set (TESTS_TARGET_NAME "${EPOXY_TARGET_NAME}_static")
- endif ()
-
- if (EPOXY_SUPPORT_EGL)
- if (EGL_FOUND)
- set (EPOXY_BUILD_EGL_TESTS TRUE)
- set (EPOXY_EGL_TESTS_COMMON egl_common.c egl_common.h)
- else ()
- set (EPOXY_BUILD_EGL_TESTS FALSE)
- message (WARNING "EGL not found - EGL tests will not be built!")
- endif ()
- endif ()
- if (EPOXY_SUPPORT_GLX)
- set (EPOXY_GLX_TESTS_COMMON glx_common.c glx_common.h)
- endif ()
- if (EPOXY_SUPPORT_WGL)
- set (EPOXY_WGL_TESTS_COMMON wgl_common.c wgl_common.h)
- endif ()
-
- set (EPOXY_LINKAGE_TYPE_SHARED SHARED)
- set (EPOXY_LINKAGE_TYPE_STATIC STATIC)
-
- function (epoxy_add_test EPOXY_TEST_NAME EPOXY_TEST_CODE)
- # Additional optional arguments: "EPOXY_TEST_DEPS EPOXY_TEST_COMPILE_DEFS EPOXY_TEST_LINK_FLAGS"
- # "EPOXY_LINKAGE_TYPE"
-
- if (ARGC GREATER 2)
- set (EPOXY_TEST_DEPS "${ARGV2}")
- else ()
- set (EPOXY_TEST_DEPS "")
- endif ()
- if (ARGC GREATER 3)
- set (EPOXY_TEST_COMPILE_DEFS "${ARGV3}")
- else ()
- set (EPOXY_TEST_COMPILE_DEFS "")
- endif ()
- if (ARGC GREATER 4)
- set (EPOXY_TEST_LINK_FLAGS "${ARGV4}")
- else ()
- set (EPOXY_TEST_LINK_FLAGS "")
- endif ()
- if (ARGC GREATER 5)
- set (EPOXY_TEST_LINKAGE_TYPE "${ARGV5}")
- else ()
- set (EPOXY_TEST_LINKAGE_TYPE BOTH)
- endif ()
-
- if (EPOXY_BUILD_SHARED AND NOT EPOXY_TEST_LINKAGE_TYPE STREQUAL EPOXY_LINKAGE_TYPE_STATIC)
- set (EPOXY_TEST_TARGET_NAME "test_shared_${EPOXY_TEST_NAME}")
- add_executable (${EPOXY_TEST_TARGET_NAME} ${EPOXY_TEST_CODE})
- target_link_libraries (${EPOXY_TEST_TARGET_NAME} "${EPOXY_TARGET_NAME}_shared" ${EPOXY_TEST_DEPS})
- target_compile_definitions (${EPOXY_TEST_TARGET_NAME} PRIVATE
- ${EPOXY_TEST_COMPILE_DEFS})
- target_include_directories (${EPOXY_TEST_TARGET_NAME} PRIVATE ${EPOXY_INCLUDE_DIRS})
- set_target_properties (${EPOXY_TEST_TARGET_NAME} PROPERTIES
- LINK_FLAGS "${EPOXY_TEST_LINK_FLAGS}")
- add_test (NAME "${EPOXY_TEST_TARGET_NAME}"
- COMMAND "${CMAKE_COMMAND}"
- "-DEPOXY_TEST_CMD=$<TARGET_FILE:${EPOXY_TEST_TARGET_NAME}>"
- "-DEPOXY_SHARED_LIB=$<TARGET_FILE:${EPOXY_TARGET_NAME}_shared>"
- "-P" "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/epoxy_run_test_wrapper.cmake")
- endif ()
-
- if (EPOXY_BUILD_STATIC AND NOT EPOXY_TEST_LINKAGE_TYPE STREQUAL EPOXY_LINKAGE_TYPE_SHARED)
- set (EPOXY_TEST_TARGET_NAME "test_static_${EPOXY_TEST_NAME}")
- add_executable (${EPOXY_TEST_TARGET_NAME} ${EPOXY_TEST_CODE})
- target_link_libraries (${EPOXY_TEST_TARGET_NAME} "${EPOXY_TARGET_NAME}_static" ${EPOXY_TEST_DEPS})
- target_compile_definitions (${EPOXY_TEST_TARGET_NAME} PRIVATE
- ${EPOXY_TEST_COMPILE_DEFS} EPOXY_STATIC_LIB)
- target_include_directories (${EPOXY_TEST_TARGET_NAME} PRIVATE ${EPOXY_INCLUDE_DIRS})
- set_target_properties (${EPOXY_TEST_TARGET_NAME} PROPERTIES
- LINK_FLAGS "${EPOXY_TEST_LINK_FLAGS}")
- add_test (NAME "${EPOXY_TEST_TARGET_NAME}"
- COMMAND "${CMAKE_COMMAND}"
- "-DEPOXY_TEST_CMD=$<TARGET_FILE:${EPOXY_TEST_TARGET_NAME}>"
- "-P" "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/epoxy_run_test_wrapper.cmake")
- endif ()
-
- endfunction ()
-
- if (EPOXY_BUILD_EGL_TESTS AND X11_FOUND)
-
- epoxy_add_test (egl_has_extension_nocontext "${EPOXY_EGL_TESTS_COMMON};egl_has_extension_nocontext.c"
- "${X11_LIBRARIES}")
- epoxy_add_test (egl_gl "${EPOXY_EGL_TESTS_COMMON};egl_gl.c" "${X11_LIBRARIES}")
- if (GLES_V1_FOUND)
- epoxy_add_test (egl_gles1_without_glx "${EPOXY_EGL_TESTS_COMMON};egl_without_glx.c" "${X11_LIBRARIES}"
- "GLES_VERSION=1")
- endif ()
- if (GLES_V2_FOUND)
- epoxy_add_test (egl_gles2_without_glx "${EPOXY_EGL_TESTS_COMMON};egl_without_glx.c" "${X11_LIBRARIES}"
- "GLES_VERSION=2")
- endif ()
- endif()
-
- if (EPOXY_BUILD_EGL_TESTS AND EPOXY_SUPPORT_GLX AND NOT APPLE)
-
- #epoxy_add_test (egl_and_glx_different_pointers "${EPOXY_EGL_TESTS_COMMON};${EPOXY_GLX_TESTS_COMMON};egl_and_glx_different_pointers.c;dlwrap.c;dlwrap.h" "${X11_LIBRARIES}" "USE_EGL;USE_GLX" "-rdynamic")
- epoxy_add_test (egl_different_pointers
- "${EPOXY_EGL_TESTS_COMMON};${EPOXY_GLX_TESTS_COMMON};egl_and_glx_different_pointers.c;dlwrap.c;dlwrap.h"
- "${X11_LIBRARIES}" "USE_EGL" "-rdynamic")
- epoxy_add_test (glx_different_pointers
- "${EPOXY_EGL_TESTS_COMMON};${EPOXY_GLX_TESTS_COMMON};egl_and_glx_different_pointers.c;dlwrap.c;dlwrap.h"
- "${X11_LIBRARIES}" "USE_GLX" "-rdynamic")
- endif ()
-
- if (EPOXY_SUPPORT_GLX)
-
- if (NOT APPLE)
- epoxy_add_test (glx_alias_prefer_same_name
- "${EPOXY_GLX_TESTS_COMMON};glx_alias_prefer_same_name.c;dlwrap.c;dlwrap.h" "${X11_LIBRARIES}"
- "" "-rdynamic")
- if (GLES_V2_FOUND)
- epoxy_add_test (test_glx_gles2
- "${EPOXY_GLX_TESTS_COMMON};glx_gles2.c;dlwrap.c;dlwrap.h" "${X11_LIBRARIES}" "" "-rdynamic")
- endif ()
- endif ()
-
- epoxy_add_test (test_glx_beginend "${EPOXY_GLX_TESTS_COMMON};glx_beginend.c"
- "${OPENGL_gl_LIBRARY};${X11_LIBRARIES}")
- epoxy_add_test (glx_public_api "${EPOXY_GLX_TESTS_COMMON};glx_public_api.c" "${X11_LIBRARIES}")
- epoxy_add_test (glx_public_api_core "${EPOXY_GLX_TESTS_COMMON};glx_public_api_core.c" "${X11_LIBRARIES}")
- epoxy_add_test (glx_getprocaddress_nocontext
- "${EPOXY_GLX_TESTS_COMMON};glx_glxgetprocaddress_nocontext.c" "${X11_LIBRARIES}")
- epoxy_add_test (glx_has_extension_nocontext "${EPOXY_GLX_TESTS_COMMON};glx_has_extension_nocontext.c"
- "${X11_LIBRARIES}")
-
- epoxy_add_test (glx_shared_znow "${EPOXY_GLX_TESTS_COMMON};glx_static.c"
- "${X11_LIBRARIES}" "" "-Wl,-z,now" SHARED)
- epoxy_add_test (glx_static "${EPOXY_GLX_TESTS_COMMON};glx_static.c"
- "${X11_LIBRARIES}" "NEEDS_TO_BE_STATIC" "" STATIC)
- endif ()
-
- epoxy_add_test (headerguards headerguards.c)
- epoxy_add_test (miscdefines miscdefines.c)
-
- if (EPOXY_SUPPORT_WGL)
- epoxy_add_test (wgl_core_and_exts "${EPOXY_WGL_TESTS_COMMON};wgl_core_and_exts.c")
- epoxy_add_test (wgl_per_context_funcptrs "${EPOXY_WGL_TESTS_COMMON};wgl_per_context_funcptrs.c")
- epoxy_add_test (wgl_usefontbitmaps_ascii "${EPOXY_WGL_TESTS_COMMON};wgl_usefontbitmaps.c")
- epoxy_add_test (wgl_usefontbitmaps_unicode "${EPOXY_WGL_TESTS_COMMON};wgl_usefontbitmaps.c"
- "" "_UNICODE;UNICODE")
- endif ()
-
-endif ()
diff --git a/test/Makefile.sources b/test/Makefile.sources
deleted file mode 100644
index a279e96..0000000
--- a/test/Makefile.sources
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright © 2014 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-EGL_TESTS_PROGS = \
- egl_has_extension_nocontext \
- egl_gl \
- egl_gles1_without_glx \
- egl_gles2_without_glx
-
-EGL_GLX_TEST_PROGS = \
- egl_and_glx_different_pointers_egl_glx \
- egl_and_glx_different_pointers_egl \
- egl_and_glx_different_pointers_glx
-
-GLX_TEST_PROGS = \
- glx_beginend \
- glx_public_api \
- glx_public_api_core \
- glx_glxgetprocaddress_nocontext \
- glx_has_extension_nocontext \
- glx_static
-
-GLX_NON_APPLE_PROGS = \
- glx_alias_prefer_same_name \
- glx_gles2
-
-WGL_TEST_PROGS = \
- wgl_core_and_exts$(EXEEXT) \
- wgl_per_context_funcptrs$(EXEEXT) \
- wgl_usefontbitmaps$(EXEEXT) \
- wgl_usefontbitmaps_unicode$(EXEEXT)
-
-GENERIC_TEST_PROGS = \
- headerguards$(EXEEXT) \
- miscdefines$(EXEEXT) \
- khronos_typedefs$(EXEEXT)
-
-DLWRAP_SRC = dlwrap.c dlwrap.h
-
-KHRONOS_TYPEDEF_SRC = \
- khronos_typedefs.c \
- khronos_typedefs.h \
- khronos_typedefs_nonepoxy.c
-
-EGL_COMMON_SRC = \
- egl_common.c \
- egl_common.h
-
-GLX_COMMON_SRC = \
- glx_common.c \
- glx_common.h
-
-WGL_COMMON_SRC = \
- wgl_common.c \
- wgl_common.h
diff --git a/test/Makefile.vc b/test/Makefile.vc
deleted file mode 100644
index 46974b6..0000000
--- a/test/Makefile.vc
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright © 2015 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-# Note: To build and use libepoxy for Visual Studio prior to Visual Studio 2013,
-# you need to ensure that you have stdint.h, inttypes.h and stdbool.h
-# that will work for your installation of Visual Studio, which can be
-# found by the compiler. One possibility would be to use msinttypes
-# and adapting gnulib's stdbool.h.in for your use.
-
-!include ..\msvc\detectenv-msvc.mak
-!include Makefile.sources
-
-EXEEXT = .exe
-
-all: config.h wgl_common.lib $(GENERIC_TEST_PROGS) $(WGL_TEST_PROGS)
-
-LD_CFLAGS = /link
-LDFLAGS = /libpath:..\src epoxy.lib gdi32.lib user32.lib $(EXTRA_LDFLAGS)
-
-CFLAGS_INCLUDES_TESTS = /I.
-
-khronos_typedefs.exe: $(KHRONOS_TYPEDEF_SRC) config.h
- $(CC) $(CFLAGS_ADD) $(CFLAGS_INCLUDES_TESTS) $(CFLAGS_C99_COMPAT) khronos_typedefs.c khronos_typedefs_nonepoxy.c /c
- link /DEBUG $(EXTRA_LDFLAGS) $*.obj $*_nonepoxy.obj /out:$@
- @if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
-
-wgl_usefontbitmaps_unicode.exe: wgl_usefontbitmaps.c wgl_common.lib config.h
- $(CC) $(CFLAGS_ADD) $(CFLAGS_INCLUDES_TESTS) $(CFLAGS_C99_COMPAT) /DUNICODE wgl_usefontbitmaps.c /Fe$@ $(LD_CFLAGS) $(LDFLAGS) wgl_common.lib
- @if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
-
-wgl_common.lib: $(WGL_COMMON_SRC)
- $(CC) $(CFLAGS_ADD) $(CFLAGS_INCLUDES_TESTS) $(CFLAGS_C99_COMPAT) /c wgl_common.c
- lib wgl_common.obj /out:$@
-
-.c$(EXEEXT):
- $(CC) $(CFLAGS_ADD) $(CFLAGS_INCLUDES_TESTS) $(CFLAGS_C99_COMPAT) $< $(LD_CFLAGS) $(LDFLAGS) wgl_common.lib
- @if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
-
-config.h:
- @echo #define BUILD_WGL 1 > config.h
-
-clean:
- @-del *.lib
- @-del *.exp
- @-del *.exe
- @-if exist *.exe.manifest del *.exe.manifest
- @-del *.ilk
- @-del *.pdb
- @-del *.obj
- @-del config.h
diff --git a/test/dlwrap.c b/test/dlwrap.c
index 0009b83..b104da4 100644
--- a/test/dlwrap.c
+++ b/test/dlwrap.c
@@ -232,10 +232,7 @@ dlwrap_real_dlsym(void *handle, const char *name)
* In the meantime, I'll just keep augmenting this
* hard-coded version list as people report bugs. */
const char *version[] = {
- "GLIBC_2.4",
- "GLIBC_2.3",
"GLIBC_2.2.5",
- "GLIBC_2.2",
"GLIBC_2.0"
};
int num_versions = sizeof(version) / sizeof(version[0]);
diff --git a/test/egl_and_glx_different_pointers.c b/test/egl_and_glx_different_pointers.c
index 009b82b..2a2ff3c 100644
--- a/test/egl_and_glx_different_pointers.c
+++ b/test/egl_and_glx_different_pointers.c
@@ -83,14 +83,12 @@ override_GLES2_glGetString(GLenum e)
GLuint
override_GL_glCreateShader(GLenum type)
{
- EPOXY_UNUSED(type);
return GL_CREATESHADER_VALUE;
}
GLuint
override_GLES2_glCreateShader(GLenum type)
{
- EPOXY_UNUSED(type);
return GLES2_CREATESHADER_VALUE;
}
@@ -138,7 +136,7 @@ init_glx(Display **out_dpy, GLXContext *out_ctx, Drawable *out_draw)
#ifdef USE_EGL
static bool
-make_egl_current_and_test(EGLDisplay dpy, EGLContext ctx)
+make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
{
const char *string;
GLuint shader;
@@ -173,15 +171,15 @@ make_egl_current_and_test(EGLDisplay dpy, EGLContext ctx)
}
static void
-init_egl(EGLDisplay *out_dpy, EGLContext *out_ctx)
+init_egl(EGLDisplay **out_dpy, EGLContext *out_ctx)
{
- EGLDisplay dpy = get_egl_display_or_skip();
+ EGLDisplay *dpy = get_egl_display_or_skip();
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE
};
static const EGLint context_attribs[] = {
@@ -209,11 +207,12 @@ init_egl(EGLDisplay *out_dpy, EGLContext *out_ctx)
}
#endif /* USE_EGL */
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
#ifdef USE_EGL
- EGLDisplay egl_dpy;
+ EGLDisplay *egl_dpy;
EGLContext egl_ctx;
#endif
#ifdef USE_GLX
diff --git a/test/egl_common.c b/test/egl_common.c
index b1ca06f..d2f11a3 100644
--- a/test/egl_common.c
+++ b/test/egl_common.c
@@ -24,25 +24,25 @@
#include <err.h>
#include <epoxy/egl.h>
#include "egl_common.h"
-#include <X11/Xlib.h>
/**
* Do whatever it takes to get us an EGL display for the system.
*
* This needs to be ported to other window systems.
*/
-EGLDisplay
+EGLDisplay *
get_egl_display_or_skip(void)
{
Display *dpy = XOpenDisplay(NULL);
EGLint major, minor;
- EGLDisplay edpy;
+ EGLDisplay *edpy;
bool ok;
if (!dpy)
errx(77, "couldn't open display\n");
- edpy = eglGetDisplay((EGLNativeDisplayType)dpy);
- if (edpy == EGL_NO_DISPLAY)
+
+ edpy = eglGetDisplay(dpy);
+ if (!edpy)
errx(1, "Couldn't get EGL display for X11 Display.\n");
ok = eglInitialize(edpy, &major, &minor);
diff --git a/test/egl_common.h b/test/egl_common.h
index 93571dc..1c5963b 100644
--- a/test/egl_common.h
+++ b/test/egl_common.h
@@ -21,5 +21,5 @@
* IN THE SOFTWARE.
*/
-EGLDisplay
+EGLDisplay *
get_egl_display_or_skip(void);
diff --git a/test/egl_gl.c b/test/egl_gl.c
index ec04607..c3fb3c2 100644
--- a/test/egl_gl.c
+++ b/test/egl_gl.c
@@ -44,7 +44,7 @@
#include "dlwrap.h"
static bool
-make_egl_current_and_test(EGLDisplay dpy, EGLContext ctx)
+make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
{
const char *string;
GLuint shader;
@@ -73,9 +73,9 @@ make_egl_current_and_test(EGLDisplay dpy, EGLContext ctx)
}
static void
-init_egl(EGLDisplay *out_dpy, EGLContext *out_ctx)
+init_egl(EGLDisplay **out_dpy, EGLContext *out_ctx)
{
- EGLDisplay dpy = get_egl_display_or_skip();
+ EGLDisplay *dpy = get_egl_display_or_skip();
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
@@ -109,10 +109,11 @@ init_egl(EGLDisplay *out_dpy, EGLContext *out_ctx)
*out_ctx = ctx;
}
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
- EGLDisplay egl_dpy;
+ EGLDisplay *egl_dpy;
EGLContext egl_ctx;
/* Force epoxy to have loaded both EGL and GLX libs already -- we
diff --git a/test/egl_has_extension_nocontext.c b/test/egl_has_extension_nocontext.c
index 942c7b3..94a7faa 100644
--- a/test/egl_has_extension_nocontext.c
+++ b/test/egl_has_extension_nocontext.c
@@ -38,11 +38,12 @@
#include "egl_common.h"
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
- EGLDisplay dpy = get_egl_display_or_skip();
+ EGLDisplay *dpy = get_egl_display_or_skip();
const char *extensions = eglQueryString(dpy, EGL_EXTENSIONS);
char *first_space;
char *an_extension;
diff --git a/test/egl_without_glx.c b/test/egl_without_glx.c
index 3ba2825..9326b5a 100644
--- a/test/egl_without_glx.c
+++ b/test/egl_without_glx.c
@@ -43,6 +43,34 @@
#include "egl_common.h"
+/**
+ * Wraps the system dlopen(), which libepoxy will end up calling when
+ * it tries to dlopen() the API libraries, and errors out the
+ * libraries we're trying to simulate not being installed on the
+ * system.
+ */
+void *
+dlopen(const char *filename, int flag)
+{
+ void * (*dlopen_unwrapped)(const char *filename, int flag);
+
+ if (!strcmp(filename, "libGL.so.1"))
+ return NULL;
+#if GLES_VERSION == 2
+ if (!strcmp(filename, "libGLESv1_CM.so.1"))
+ return NULL;
+#else
+ if (!strcmp(filename, "libGLESv2.so.2"))
+ return NULL;
+#endif
+
+ dlopen_unwrapped = dlsym(RTLD_NEXT, "dlopen");
+ assert(dlopen_unwrapped);
+
+ return dlopen_unwrapped(filename, flag);
+}
+
+
static EGLenum last_api;
static EGLenum extra_error = EGL_SUCCESS;
@@ -87,10 +115,11 @@ override_eglGetError(void)
return real_eglGetError();
}
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
- EGLDisplay dpy = get_egl_display_or_skip();
+ EGLDisplay *dpy = get_egl_display_or_skip();
EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION,
EGL_NONE
@@ -101,11 +130,7 @@ int main(void)
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
-#if GLES_VERSION == 2
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
-#else
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
-#endif
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE
};
EGLint count;
diff --git a/test/glx_alias_prefer_same_name.c b/test/glx_alias_prefer_same_name.c
index bdaf367..cfc1344 100644
--- a/test/glx_alias_prefer_same_name.c
+++ b/test/glx_alias_prefer_same_name.c
@@ -53,18 +53,17 @@ override_GL_glBindTextureEXT(GLenum target);
void
override_GL_glBindTexture(GLenum target)
{
- EPOXY_UNUSED(target);
last_call = CORE_FUNC_VAL;
}
void
override_GL_glBindTextureEXT(GLenum target)
{
- EPOXY_UNUSED(target);
last_call = EXT_FUNC_VAL;
}
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
diff --git a/test/glx_beginend.c b/test/glx_beginend.c
index bfed424..c68f408 100644
--- a/test/glx_beginend.c
+++ b/test/glx_beginend.c
@@ -89,7 +89,8 @@ test_without_epoxy(void)
return true;
}
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
diff --git a/test/glx_common.c b/test/glx_common.c
index d1e5954..fda1602 100644
--- a/test/glx_common.c
+++ b/test/glx_common.c
@@ -72,8 +72,6 @@ get_glx_window(Display *dpy, XVisualInfo *visinfo, bool map)
Window root_win = RootWindow(dpy, screen);
Window win;
- EPOXY_UNUSED(map);
-
window_attr.background_pixel = 0;
window_attr.border_pixel = 0;
window_attr.colormap = XCreateColormap(dpy, root_win,
@@ -121,7 +119,7 @@ get_fbconfig_for_visinfo(Display *dpy, XVisualInfo *visinfo)
if (glXGetFBConfigAttrib(dpy, configs[i], GLX_VISUAL_ID, &v))
continue;
- if (v == (int)visinfo->visualid) {
+ if (v == visinfo->visualid) {
ret = configs[i];
break;
}
diff --git a/test/glx_gles2.c b/test/glx_gles2.c
index 20debbb..969d26b 100644
--- a/test/glx_gles2.c
+++ b/test/glx_gles2.c
@@ -46,7 +46,6 @@ override_GLES2_glCreateShader(GLenum target);
GLuint
override_GLES2_glCreateShader(GLenum target)
{
- EPOXY_UNUSED(target);
return 0;
}
@@ -61,7 +60,8 @@ override_GLES2_glGenQueries(GLsizei n, GLuint *ids)
ids[i] = 0;
}
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
XVisualInfo *vis;
diff --git a/test/glx_glxgetprocaddress_nocontext.c b/test/glx_glxgetprocaddress_nocontext.c
index 357aa15..2182215 100644
--- a/test/glx_glxgetprocaddress_nocontext.c
+++ b/test/glx_glxgetprocaddress_nocontext.c
@@ -39,7 +39,8 @@
static Display *dpy;
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
void *func;
diff --git a/test/glx_has_extension_nocontext.c b/test/glx_has_extension_nocontext.c
index dde0acb..2f87ac3 100644
--- a/test/glx_has_extension_nocontext.c
+++ b/test/glx_has_extension_nocontext.c
@@ -39,7 +39,8 @@
static Display *dpy;
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
diff --git a/test/glx_public_api.c b/test/glx_public_api.c
index a99eaeb..e38d260 100644
--- a/test/glx_public_api.c
+++ b/test/glx_public_api.c
@@ -107,7 +107,8 @@ test_glx_extension_supported(void)
return true;
}
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
diff --git a/test/glx_public_api_core.c b/test/glx_public_api_core.c
index 1dcc36d..29252ec 100644
--- a/test/glx_public_api_core.c
+++ b/test/glx_public_api_core.c
@@ -130,7 +130,8 @@ test_glx_version(void)
return true;
}
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
XVisualInfo *visinfo;
diff --git a/test/glx_static.c b/test/glx_static.c
index acf1644..d528a60 100644
--- a/test/glx_static.c
+++ b/test/glx_static.c
@@ -42,7 +42,8 @@
#include "glx_common.h"
-int main(void)
+int
+main(int argc, char **argv)
{
bool pass = true;
int val;
diff --git a/test/headerguards.c b/test/headerguards.c
index 732a0b9..866b506 100644
--- a/test/headerguards.c
+++ b/test/headerguards.c
@@ -21,31 +21,40 @@
* IN THE SOFTWARE.
*/
+#include <config.h>
+
#include <epoxy/gl.h>
-#if EPOXY_SUPPORT_EGL
- #include <epoxy/egl.h>
- #include <epoxy/egl.h>
+#ifdef BUILD_EGL
+#include <epoxy/egl.h>
+#include <epoxy/egl.h>
+#endif
+
+#ifdef BUILD_GLX
+#include <epoxy/glx.h>
+#include <epoxy/glx.h>
#endif
-#if EPOXY_SUPPORT_GLX
- #include <epoxy/glx.h>
- #include <epoxy/glx.h>
+#ifdef BUILD_EGL
+#include <EGL/egl.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <EGL/eglext.h>
#endif
-#if EPOXY_SUPPORT_GLX
- #ifdef __APPLE__
- #include <OpenGL/gl.h>
- #include <OpenGL/glext.h>
- #else
- #include <GL/gl.h>
- #include <GL/glext.h>
- #endif
- #include <GL/glx.h>
- #include <GL/glxext.h>
+#ifdef BUILD_GLX
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#else
+#include <GL/gl.h>
+#include <GL/glext.h>
+#endif
+#include <GL/glx.h>
+#include <GL/glxext.h>
#endif
-int main(void)
+int main(int argc, char **argv)
{
return 0;
}
diff --git a/test/khronos_typedefs_nonepoxy.c b/test/khronos_typedefs_nonepoxy.c
index 56ee814..64d5a1b 100644
--- a/test/khronos_typedefs_nonepoxy.c
+++ b/test/khronos_typedefs_nonepoxy.c
@@ -24,9 +24,12 @@
#include <stdio.h>
#include <stdlib.h>
+#include "config.h"
#include "khronos_typedefs.h"
-#include "epoxy/khrplatform.h"
+#ifdef HAVE_KHRPLATFORM_H
+
+#include <KHR/khrplatform.h>
#define GET_SIZE(type) sizes[type ## _slot] = sizeof(type)
@@ -50,3 +53,17 @@ get_system_typedef_sizes(uint32_t *sizes)
GET_SIZE(khronos_stime_nanoseconds_t);
GET_SIZE(khronos_boolean_enum_t);
}
+
+#else /* !HAVE_KHRPLATFORM_H */
+
+/* Don't care -- this is a conditional case in test code. */
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"
+
+void
+get_system_typedef_sizes(uint32_t *sizes)
+{
+ fprintf(stderr, "./configure failed to find khrplatform.h\n");
+ exit(77);
+}
+
+#endif
diff --git a/test/miscdefines.c b/test/miscdefines.c
index 89a8c87..e4bc79a 100644
--- a/test/miscdefines.c
+++ b/test/miscdefines.c
@@ -23,11 +23,11 @@
#include <epoxy/gl.h>
-#if EPOXY_SUPPORT_EGL
+#ifdef BUILD_EGL
#include <epoxy/egl.h>
#endif
-#if EPOXY_SUPPORT_GLX
+#ifdef BUILD_GLX
#include <epoxy/glx.h>
#endif
@@ -61,7 +61,7 @@
/* Do we want to export GL_GLEXT_VERSION? */
-int main(void)
+int main(int argc, char **argv)
{
return 0;
}
diff --git a/test/wgl_common.c b/test/wgl_common.c
index 7d700ab..97b69ed 100644
--- a/test/wgl_common.c
+++ b/test/wgl_common.c
@@ -85,8 +85,8 @@ window_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
void
make_window_and_test(int (*callback)(HDC hdc))
{
- LPCTSTR class_name = TEXT("epoxy");
- LPCTSTR window_name = TEXT("epoxy");
+ const char *class_name = "epoxy";
+ const char *window_name = "epoxy";
int width = 150;
int height = 150;
HWND hwnd;
diff --git a/test/wgl_core_and_exts.c b/test/wgl_core_and_exts.c
index c909541..bbb2645 100644
--- a/test/wgl_core_and_exts.c
+++ b/test/wgl_core_and_exts.c
@@ -21,6 +21,7 @@
* IN THE SOFTWARE.
*/
+#include <config.h>
#include <stdio.h>
#include "wgl_common.h"
@@ -70,7 +71,8 @@ test_function(HDC hdc)
return !pass;
}
-int main()
+int
+main(int argc, char **argv)
{
make_window_and_test(test_function);
diff --git a/test/wgl_per_context_funcptrs.c b/test/wgl_per_context_funcptrs.c
index 4e5f3fb..c76c7b3 100644
--- a/test/wgl_per_context_funcptrs.c
+++ b/test/wgl_per_context_funcptrs.c
@@ -35,6 +35,7 @@
* regardless.
*/
+#include <config.h>
#include <stdio.h>
#include <assert.h>
@@ -56,7 +57,6 @@ OVERRIDE_API (PROC) override_wglGetProcAddress(LPCSTR name);
OVERRIDE_API (GLuint)
override_glCreateShader_ctx1(GLenum target)
{
- EPOXY_UNUSED(target);
if (current_context != ctx1) {
fprintf(stderr, "ctx1 called while other context current\n");
pass = false;
@@ -67,7 +67,6 @@ override_glCreateShader_ctx1(GLenum target)
OVERRIDE_API (GLuint)
override_glCreateShader_ctx2(GLenum target)
{
- EPOXY_UNUSED(target);
if (current_context != ctx2) {
fprintf(stderr, "ctx2 called while other context current\n");
pass = false;
@@ -157,7 +156,8 @@ test_function(HDC hdc)
return !pass;
}
-int main()
+int
+main(int argc, char **argv)
{
make_window_and_test(test_function);
diff --git a/test/wgl_usefontbitmaps.c b/test/wgl_usefontbitmaps.c
index b40f573..3287b65 100644
--- a/test/wgl_usefontbitmaps.c
+++ b/test/wgl_usefontbitmaps.c
@@ -21,6 +21,7 @@
* IN THE SOFTWARE.
*/
+#include <config.h>
#include <stdio.h>
#include "wgl_common.h"
@@ -47,7 +48,7 @@ test_function(HDC hdc)
/* First, use the #ifdeffed variant of the function */
wglUseFontBitmaps(hdc, 0, 255, dlist[1]);
glListBase(dlist[1]);
- glCallLists((GLsizei)strlen(string), GL_UNSIGNED_BYTE, string);
+ glCallLists(strlen(string), GL_UNSIGNED_BYTE, string);
/* Now, use the specific version, manually. */
#ifdef UNICODE
@@ -56,7 +57,7 @@ test_function(HDC hdc)
wglUseFontBitmapsA(hdc, 0, 255, dlist[2]);
#endif
glListBase(dlist[2]);
- glCallLists((GLsizei)strlen(string), GL_UNSIGNED_BYTE, string);
+ glCallLists(strlen(string), GL_UNSIGNED_BYTE, string);
wglMakeCurrent(NULL, NULL);
wglDeleteContext(ctx);
@@ -64,7 +65,8 @@ test_function(HDC hdc)
return !pass;
}
-int main()
+int
+main(int argc, char **argv)
{
make_window_and_test(test_function);