[Mesa-dev] [PATCH 2/8] dri: Reuse dri_test.c for stub glapi symbols for unit testing.

Eric Anholt eric at anholt.net
Fri Aug 31 11:32:35 PDT 2012


This file was previously used to provide stubs for the link test.  Now
that the link test wasn't used any more, there's no more purpose for
this file.  However, these will be nice for linking unit tests against
the whole contents of a dri driver.
---
 src/mesa/drivers/dri/common/Makefile.am |    8 +++++++-
 src/mesa/drivers/dri/common/dri_test.c  |    2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/common/Makefile.am b/src/mesa/drivers/dri/common/Makefile.am
index d81bc0e..6e9d738 100644
--- a/src/mesa/drivers/dri/common/Makefile.am
+++ b/src/mesa/drivers/dri/common/Makefile.am
@@ -28,11 +28,17 @@ AM_CFLAGS = \
 	$(API_DEFINES) \
 	$(LIBDRM_CFLAGS)
 
-noinst_LTLIBRARIES = libdricommon.la
+noinst_LTLIBRARIES = \
+	libdricommon.la \
+	libdri_test_stubs.la
 
 libdricommon_la_SOURCES = \
 	utils.c \
 	dri_util.c \
 	xmlconfig.c
 
+libdri_test_stubs_la_SOURCES = \
+	dri_test.c
+libdri_test_stubs_la_CFLAGS = $(AM_CFLAGS) -DNO_MAIN
+
 sysconf_DATA = drirc
diff --git a/src/mesa/drivers/dri/common/dri_test.c b/src/mesa/drivers/dri/common/dri_test.c
index 793f0c3..3573285 100644
--- a/src/mesa/drivers/dri/common/dri_test.c
+++ b/src/mesa/drivers/dri/common/dri_test.c
@@ -82,8 +82,10 @@ _glthread_GetID(void)
    return 0;
 }
 
+#ifndef NO_MAIN
 int main(int argc, char** argv)
 {
    void* p = __driDriverExtensions;
    return (int)(unsigned long)p;
 }
+#endif
-- 
1.7.10.4



More information about the mesa-dev mailing list