dri: Reuse dri_test.c for stub glapi symbols for unit testing.
authorEric Anholt <eric@anholt.net>
Thu, 2 Feb 2012 13:11:08 +0000 (14:11 +0100)
committerEric Anholt <eric@anholt.net>
Mon, 17 Sep 2012 19:32:51 +0000 (12:32 -0700)
This file is used to provide stubs for the link test in gallium dri drivers.
But the same stubs without the main can be used for making unit tests for code
in a dri driver.

Acked-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/common/Makefile.am
src/mesa/drivers/dri/common/dri_test.c

index d81bc0e3f4ddeccb46cdf07f64044a52ce20cae0..6e9d738fa52f26ee695ae48cb64473e730e57cc2 100644 (file)
@@ -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
index 793f0c37d79247f5df664f10f298694ba4981b42..35732857dda816d97e064b1c2af68cf6f6c1d4f3 100644 (file)
@@ -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