Use --enable-unit-tests for unit tests, separate from --enable-tests

This commit is contained in:
Yevgen Muntyan 2008-01-20 12:03:01 -06:00
parent ff8d8b5b4c
commit 3a244480c7
9 changed files with 43 additions and 13 deletions

View File

@ -61,6 +61,10 @@ endif
if MOO_ENABLE_TESTS
SUBDIRS += tests
else
if MOO_ENABLE_UNIT_TESTS
SUBDIRS += tests
endif
endif
ACLOCAL_AMFLAGS = -I m4

View File

@ -44,6 +44,23 @@ AC_ARG_ENABLE(tests,
])
AM_CONDITIONAL(MOO_ENABLE_TESTS, test x$MOO_ENABLE_TESTS = "xyes")
AC_ARG_ENABLE(unit-tests,
AC_HELP_STRING([--enable-unit-tests],[build unit tests (default = NO)]),[
if test "x$enable_unit_tests" = "xno"; then
MOO_ENABLE_UNIT_TESTS="no"
else
MOO_ENABLE_UNIT_TESTS="yes"
fi
],[
MOO_ENABLE_UNIT_TESTS="no"
])
if test x$MOO_ENABLE_UNIT_TESTS = "xyes"; then
AC_CHECK_LIB(cunit, CU_assertImplementation,[:],[
AC_MSG_ERROR("CUnit is required for unit tests")
])
fi
AM_CONDITIONAL(MOO_ENABLE_UNIT_TESTS, test x$MOO_ENABLE_UNIT_TESTS = "xyes")
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debug options (default = NO)]),[
if test "x$enable_debug" = "xno"; then
@ -114,6 +131,9 @@ MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS $_moo_debug_flags"
if test "x$MOO_ENABLE_TESTS" = "xyes"; then
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS -DMOO_ENABLE_TESTS"
fi
if test "x$MOO_ENABLE_UNIT_TESTS" = "xyes"; then
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS -DMOO_ENABLE_UNIT_TESTS"
fi
AC_SUBST(MOO_DEBUG_CFLAGS)

View File

@ -17,6 +17,8 @@ static const char THANKS [] = ""
"Federico Mena Quintero\n"
"Geoffrey French\n"
"Jeroen Zwartepoorte\n"
"Kenneth Prugh\n"
"LoneFox\n"
"Lontronics\n"
"Marco Barisione\n"
"Matthias Clasen\n"

View File

@ -8,7 +8,7 @@
<debug>
<build_dir>build/debug</build_dir>
<configure>
<args>--enable-debug=full --enable-all-warnings --enable-project --enable-tests</args>
<args>--enable-debug=full --enable-all-warnings --enable-project --enable-unit-tests</args>
<vars>
<var name="CFLAGS">-g</var>
<var name="OBJCFLAGS">-g</var>

View File

@ -105,7 +105,7 @@ libmoo_la_LDFLAGS = $(libmoo_res_ldflag) -no-undefined -avoid-version $(export_f
libmoo_la_SOURCES = $(moo_include_headers) moo-tests.h moo-tests-utils.h
nodist_libmoo_la_SOURCES += $(nodist_moo_include_headers)
if MOO_ENABLE_TESTS
if MOO_ENABLE_UNIT_TESTS
libmoo_la_LIBADD += -lcunit
endif

View File

@ -585,7 +585,7 @@ _moo_accel_normalize (const char *accel)
}
#ifdef MOO_ENABLE_TESTS
#ifdef MOO_ENABLE_UNIT_TESTS
#include <moo-tests.h>
#include <locale.h>

View File

@ -603,7 +603,7 @@ normalize_full_path_unix (const char *path)
#endif /* !__WIN32__ */
#if defined(__WIN32__) || defined(MOO_ENABLE_TESTS)
#if defined(__WIN32__) || defined(MOO_ENABLE_UNIT_TESTS)
static char *
normalize_full_path_win32 (const char *fullpath)
@ -764,7 +764,7 @@ _moo_normalize_dir_path (const char *filename)
#endif
#ifdef MOO_ENABLE_TESTS
#ifdef MOO_ENABLE_UNIT_TESTS
#include <moo-tests.h>
@ -1000,7 +1000,7 @@ moo_test_mooutils_fs (void)
#endif
}
#endif /* MOO_ENABLE_TESTS */
#endif /* MOO_ENABLE_UNIT_TESTS */
/**********************************************************************/

View File

@ -301,7 +301,7 @@ _moo_win32_fnmatch (const char *pattern,
}
#ifdef MOO_ENABLE_TESTS
#ifdef MOO_ENABLE_UNIT_TESTS
#include <moo-tests.h>

View File

@ -5,9 +5,10 @@ AM_CFLAGS = \
$(MOO_DEBUG_CFLAGS)
AM_OBJCFLAGS = $(AM_CFLAGS)
noinst_PROGRAMS = run-tests
noinst_PROGRAMS =
unit_test_programs = run-tests
# noinst_PROGRAMS =
test_programs = \
markup testpaned miniglade \
testobject testthreads
@ -25,11 +26,14 @@ if MOO_BUILD_APP
test_programs += testhtml
endif
EXTRA_PROGRAMS = $(test_programs)
EXTRA_PROGRAMS = $(test_programs) $(unit_test_programs)
# if MOO_ENABLE_TESTS
# noinst_PROGRAMS += $(test_programs)
# endif
if MOO_ENABLE_TESTS
noinst_PROGRAMS += $(test_programs)
endif
if MOO_ENABLE_UNIT_TESTS
noinst_PROGRAMS += $(unit_test_programs)
endif
all-tests: $(EXTRA_PROGRAMS)