unit tests: build adjustment

Also define UNITTESTS macro when building unit test sources.

Fixing compiler warning: external definition with no prior declaration
This commit is contained in:
Yang Tse 2011-05-25 20:22:46 +02:00
parent 017ee34bba
commit 9f390a356e
4 changed files with 13 additions and 5 deletions

View File

@ -49,7 +49,10 @@ char *libtest_arg2=NULL;
char *libtest_arg3=NULL; char *libtest_arg3=NULL;
int test_argc; int test_argc;
char **test_argv; char **test_argv;
#ifdef UNITTESTS
int unitfail; /* for unittests */ int unitfail; /* for unittests */
#endif
int main(int argc, char **argv) int main(int argc, char **argv)
{ {

View File

@ -73,3 +73,6 @@ extern int select_test(int num_fds, fd_set *rd, fd_set *wr, fd_set *exc,
extern int test(char *URL); /* the actual test function provided by each extern int test(char *URL); /* the actual test function provided by each
individual libXXX.c file */ individual libXXX.c file */
#ifdef UNITTESTS
extern int unitfail;
#endif

View File

@ -40,7 +40,7 @@ INCLUDES = -I$(top_builddir)/include/curl \
-I$(top_srcdir)/include \ -I$(top_srcdir)/include \
-I$(top_builddir)/lib \ -I$(top_builddir)/lib \
-I$(top_srcdir)/lib \ -I$(top_srcdir)/lib \
-I$(top_srcdir)/tests/libtest \ -I$(top_srcdir)/tests/libtest \
-I$(top_builddir)/ares \ -I$(top_builddir)/ares \
-I$(top_srcdir)/ares -I$(top_srcdir)/ares
else else
@ -49,16 +49,16 @@ INCLUDES = -I$(top_builddir)/include/curl \
-I$(top_srcdir)/include \ -I$(top_srcdir)/include \
-I$(top_builddir)/lib \ -I$(top_builddir)/lib \
-I$(top_srcdir)/lib \ -I$(top_srcdir)/lib \
-I$(top_srcdir)/tests/libtest -I$(top_srcdir)/tests/libtest
endif endif
if CURLDEBUG if CURLDEBUG
EXTRA_DIST = Makefile.inc EXTRA_DIST = Makefile.inc
LDADD = $(top_builddir)/tests/libtest/first.o $(top_builddir)/lib/libcurlu.la \ LDADD = $(top_builddir)/lib/libcurlu.la @CURL_LIBS@
@CURL_LIBS@
DEPENDENCIES = $(top_builddir)/lib/libcurlu.la DEPENDENCIES = $(top_builddir)/lib/libcurlu.la
CFLAGS += -DUNITTESTS
# Makefile.inc provides the source defines (TESTUTIL, SUPPORTFILES, # Makefile.inc provides the source defines (TESTUTIL, SUPPORTFILES,
# noinst_PROGRAMS, lib*_SOURCES, and lib*_CFLAGS) # noinst_PROGRAMS, lib*_SOURCES, and lib*_CFLAGS)

View File

@ -1,6 +1,8 @@
# these files are used in every single unit test program # these files are used in every single unit test program
UNITFILES = curlcheck.h UNITFILES = curlcheck.h \
$(top_srcdir)/tests/libtest/test.h \
$(top_srcdir)/tests/libtest/first.c
# These are all unit test programs # These are all unit test programs
noinst_PROGRAMS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307 noinst_PROGRAMS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307