diff options
author | 21:06:47 Tim Janik <timj@imendio.com> | 2007-11-21 20:09:46 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2007-11-21 20:09:46 +0000 |
commit | 1e55738f31385ddb3bf172ba3590a79cf42782f4 (patch) | |
tree | 7fe6d77dc08924cce36731cfc2ed42295cf35df0 | |
parent | 49568d5f163a661f1d52a25bd450a4c6ca5b3e18 (diff) | |
download | glib-1e55738f31385ddb3bf172ba3590a79cf42782f4.tar.gz |
initialize automake variables EXTRA_DIST and TEST_PROGS for unconditional
2007-11-21 21:06:47 Tim Janik <timj@imendio.com>
* Makefile.decl: initialize automake variables EXTRA_DIST and
TEST_PROGS for unconditional appending via += in other makefiles.
define recursive test targets: test, test-report, perf-report,
full-report, as described here:
http://mail.gnome.org/archives/gtk-devel-list/2007-November/msg00000.html
* Makefile.am:
* build/win32/vs8/Makefile.am, build/win32/dirent/Makefile.am:
* build/win32/Makefile.am, build/Makefile.am:
* docs/Makefile.am, docs/reference/Makefile.am:
* docs/reference/glib/Makefile.am, docs/reference/gobject/Makefile.am:
* gmodule/Makefile.am, tests/Makefile.am:
* tests/refcount/Makefile.am, tests/gobject/Makefile.am:
* glib/update-pcre/Makefile.am, glib/libcharset/Makefile.am:
* glib/tests/Makefile.am, glib/pcre/Makefile.am:
* glib/gnulib/Makefile.am, gobject/Makefile.am, m4macros/Makefile.am:
* gthread/Makefile.am, glib/Makefile.am:
include $(top_srcdir)/Makefile.decl, adapted EXTRA_DIST assignments.
* glib/tests/Makefile.am: removed example testing rules.
* glib/tests/testing.c: conditionalized performance and slow tests.
* glib/gtestutils.h:
* glib/gtestutils.c: work around g_test_config_vars not changing its
exported value after value assignments, aparently due to symbol aliases.
* glib/gtester.c: fixed off-by-one error which produced junk in logs.
* configure.in: check for python >= 2.4 and provide $PYTHON for scripts.
svn path=/trunk/; revision=5914
-rw-r--r-- | ChangeLog | 33 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | Makefile.decl | 56 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | docs/Makefile.am | 3 | ||||
-rw-r--r-- | docs/reference/Makefile.am | 2 | ||||
-rw-r--r-- | docs/reference/glib/Makefile.am | 1 | ||||
-rw-r--r-- | docs/reference/gobject/Makefile.am | 1 | ||||
-rw-r--r-- | glib/Makefile.am | 3 | ||||
-rw-r--r-- | glib/gnulib/Makefile.am | 1 | ||||
-rw-r--r-- | glib/gtester.c | 4 | ||||
-rw-r--r-- | glib/gtestutils.c | 9 | ||||
-rw-r--r-- | glib/gtestutils.h | 4 | ||||
-rw-r--r-- | glib/libcharset/Makefile.am | 3 | ||||
-rw-r--r-- | glib/pcre/Makefile.am | 4 | ||||
-rw-r--r-- | glib/tests/Makefile.am | 14 | ||||
-rw-r--r-- | glib/tests/testing.c | 6 | ||||
-rw-r--r-- | glib/update-pcre/Makefile.am | 4 | ||||
-rw-r--r-- | gmodule/Makefile.am | 3 | ||||
-rw-r--r-- | gobject/Makefile.am | 3 | ||||
-rw-r--r-- | gthread/Makefile.am | 3 | ||||
-rw-r--r-- | m4macros/Makefile.am | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/gobject/Makefile.am | 4 | ||||
-rw-r--r-- | tests/refcount/Makefile.am | 2 |
25 files changed, 144 insertions, 33 deletions
@@ -1,3 +1,36 @@ +2007-11-21 21:06:47 Tim Janik <timj@imendio.com> + + * Makefile.decl: initialize automake variables EXTRA_DIST and + TEST_PROGS for unconditional appending via += in other makefiles. + define recursive test targets: test, test-report, perf-report, + full-report, as described here: + http://mail.gnome.org/archives/gtk-devel-list/2007-November/msg00000.html + + * Makefile.am: + * build/win32/vs8/Makefile.am, build/win32/dirent/Makefile.am: + * build/win32/Makefile.am, build/Makefile.am: + * docs/Makefile.am, docs/reference/Makefile.am: + * docs/reference/glib/Makefile.am, docs/reference/gobject/Makefile.am: + * gmodule/Makefile.am, tests/Makefile.am: + * tests/refcount/Makefile.am, tests/gobject/Makefile.am: + * glib/update-pcre/Makefile.am, glib/libcharset/Makefile.am: + * glib/tests/Makefile.am, glib/pcre/Makefile.am: + * glib/gnulib/Makefile.am, gobject/Makefile.am, m4macros/Makefile.am: + * gthread/Makefile.am, glib/Makefile.am: + include $(top_srcdir)/Makefile.decl, adapted EXTRA_DIST assignments. + + * glib/tests/Makefile.am: removed example testing rules. + + * glib/tests/testing.c: conditionalized performance and slow tests. + + * glib/gtestutils.h: + * glib/gtestutils.c: work around g_test_config_vars not changing its + exported value after value assignments, aparently due to symbol aliases. + + * glib/gtester.c: fixed off-by-one error which produced junk in logs. + + * configure.in: check for python >= 2.4 and provide $PYTHON for scripts. + Tue Nov 20 15:59:55 2007 +0100 Tim Janik Renamed gtestframework to gtestutils. diff --git a/Makefile.am b/Makefile.am index f685cf2ec..e36285c6d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,5 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl AUTOMAKE_OPTIONS = 1.7 @@ -9,7 +10,7 @@ bin_SCRIPTS = glib-gettextize INCLUDES = -DG_LOG_DOMAIN=g_log_domain_glib @GLIB_DEBUG_FLAGS@ \ -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -EXTRA_DIST = \ +EXTRA_DIST += \ ChangeLog.pre-2-14 \ ChangeLog.pre-2-12 \ ChangeLog.pre-2-10 \ diff --git a/Makefile.decl b/Makefile.decl new file mode 100644 index 000000000..2c061b32c --- /dev/null +++ b/Makefile.decl @@ -0,0 +1,56 @@ +# GLIB - Library of useful C routines + +#GTESTER = gtester # for non-GLIB packages +GTESTER = $(top_builddir)/glib/gtester # for the GLIB package + +# initialize variables for unconditional += appending +EXTRA_DIST = +TEST_PROGS = + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +# test-report: run tests in subdirs and generate report +# perf-report: run tests in subdirs with -m perf and generate report +# full-report: like test-report: with -m perf and -m slow +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '<?xml version="1.0"?>' > $@.xml ; \ + echo '<report-collection>' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '</report-collection>' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test diff --git a/configure.in b/configure.in index fb6f19f5f..adc3ab520 100644 --- a/configure.in +++ b/configure.in @@ -366,6 +366,10 @@ if test "x$PERL_PATH" = x ; then fi AC_SUBST(PERL_PATH) +# Need suitable python path for greport +AM_PATH_PYTHON(2.4,,PYTHON="/usr/bin/env python2.4") + + dnl *********************** dnl *** Tests for iconv *** dnl *********************** diff --git a/docs/Makefile.am b/docs/Makefile.am index c44793630..2349f44f6 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,8 +1,9 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl SUBDIRS = reference -EXTRA_DIST = debugging.txt macros.txt +EXTRA_DIST += debugging.txt macros.txt files: @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \ diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index c5c7e965a..7f2aab06d 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -1 +1,3 @@ +include $(top_srcdir)/Makefile.decl + SUBDIRS = glib gobject diff --git a/docs/reference/glib/Makefile.am b/docs/reference/glib/Makefile.am index ffa113fa4..97a3562be 100644 --- a/docs/reference/glib/Makefile.am +++ b/docs/reference/glib/Makefile.am @@ -1,4 +1,5 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl AUTOMAKE_OPTIONS = 1.6 # The name of the module. diff --git a/docs/reference/gobject/Makefile.am b/docs/reference/gobject/Makefile.am index c1cc1f118..00ee0ea55 100644 --- a/docs/reference/gobject/Makefile.am +++ b/docs/reference/gobject/Makefile.am @@ -1,4 +1,5 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl # The name of the module. DOC_MODULE=gobject diff --git a/glib/Makefile.am b/glib/Makefile.am index 4f5822ad1..b77c29bea 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -1,4 +1,5 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl if HAVE_GOOD_PRINTF else @@ -52,7 +53,7 @@ MIRRORING_TAB_SOURCE = \ # The compilation of GRegex can be disabled, but the source files must # be distributed. -EXTRA_DIST = \ +EXTRA_DIST += \ makefile.msc.in \ glib.rc.in \ gen-unicode-tables.pl \ diff --git a/glib/gnulib/Makefile.am b/glib/gnulib/Makefile.am index 2387885d8..fb4ecfac8 100644 --- a/glib/gnulib/Makefile.am +++ b/glib/gnulib/Makefile.am @@ -1,4 +1,5 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib -DG_LOG_DOMAIN=\"GLib\" \ $(GLIB_DEBUG_FLAGS) -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION diff --git a/glib/gtester.c b/glib/gtester.c index 77028da80..395970e2e 100644 --- a/glib/gtester.c +++ b/glib/gtester.c @@ -65,8 +65,8 @@ static const char* sindent (guint n) { static const char spaces[] = " "; - int l = sizeof (spaces); - n = MIN (n, l - 1); + int l = sizeof (spaces) - 1; + n = MIN (n, l); return spaces + l - n; } diff --git a/glib/gtestutils.c b/glib/gtestutils.c index b275a6809..8335a5892 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -83,13 +83,14 @@ static char *test_trap_last_stderr = NULL; static char *test_uri_base = NULL; static gboolean test_debug_log = FALSE; static DestroyEntry *test_destroy_queue = NULL; -const GTestConfig *g_test_config_vars = NULL; static GTestConfig mutable_test_config_vars = { + FALSE, /* test_initialized */ TRUE, /* test_quick */ FALSE, /* test_perf */ FALSE, /* test_verbose */ FALSE, /* test_quiet */ }; +const GTestConfig * const g_test_config_vars = &mutable_test_config_vars; /* --- functions --- */ const char* @@ -376,8 +377,8 @@ g_test_init (int *argc, /* check caller args */ g_return_if_fail (argc != NULL); g_return_if_fail (argv != NULL); - g_return_if_fail (g_test_config_vars == NULL); - g_test_config_vars = &mutable_test_config_vars; + g_return_if_fail (g_test_config_vars->test_initialized == FALSE); + mutable_test_config_vars.test_initialized = TRUE; va_start (args, argv); vararg1 = va_arg (args, gpointer); /* reserved for future extensions */ @@ -1009,7 +1010,7 @@ int g_test_run_suite (GTestSuite *suite) { guint n_bad = 0; - g_return_val_if_fail (g_test_config_vars != NULL, -1); + g_return_val_if_fail (g_test_config_vars->test_initialized, -1); g_return_val_if_fail (g_test_run_once == TRUE, -1); g_test_run_once = FALSE; if (!test_paths) diff --git a/glib/gtestutils.h b/glib/gtestutils.h index 2b60b72a5..d2c969013 100644 --- a/glib/gtestutils.h +++ b/glib/gtestutils.h @@ -67,6 +67,7 @@ void g_test_init (int *argc, ...); /* query testing framework config */ #define g_test_quick() (g_test_config_vars->test_quick) +#define g_test_slow() (!g_test_config_vars->test_quick) #define g_test_perf() (g_test_config_vars->test_perf) #define g_test_verbose() (g_test_config_vars->test_verbose) #define g_test_quiet() (g_test_config_vars->test_quiet) @@ -180,12 +181,13 @@ void g_test_add_vtable (const char *testpath, void (*data_test) (void), void (*data_teardown) (void)); typedef struct { + gboolean test_initialized; gboolean test_quick; /* disable thorough tests */ gboolean test_perf; /* run performance tests */ gboolean test_verbose; /* extra info */ gboolean test_quiet; /* reduce output */ } GTestConfig; -GLIB_VAR const GTestConfig *g_test_config_vars; +GLIB_VAR const GTestConfig * const g_test_config_vars; /* internal logging API */ typedef enum { diff --git a/glib/libcharset/Makefile.am b/glib/libcharset/Makefile.am index c01945722..3cf4ab3ae 100644 --- a/glib/libcharset/Makefile.am +++ b/glib/libcharset/Makefile.am @@ -1,4 +1,5 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl INCLUDES = \ -DLIBDIR=\"$(libdir)\" -I$(top_srcdir) @@ -9,7 +10,7 @@ libcharset_la_SOURCES = \ libcharset.h \ localcharset.c -EXTRA_DIST = \ +EXTRA_DIST += \ README \ config.charset \ ref-add.sin \ diff --git a/glib/pcre/Makefile.am b/glib/pcre/Makefile.am index c5aedb673..a9971a8e4 100644 --- a/glib/pcre/Makefile.am +++ b/glib/pcre/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.decl + INCLUDES = \ -DG_LOG_DOMAIN=\"GLib-GRegex\" \ -DSUPPORT_UCP \ @@ -58,7 +60,7 @@ libpcre_la_LIBADD = $(DEP_LIBS) libpcre_la_LDFLAGS = -no-undefined -EXTRA_DIST = \ +EXTRA_DIST += \ COPYING \ makefile.msc diff --git a/glib/tests/Makefile.am b/glib/tests/Makefile.am index e2057a4f3..ad408f81a 100644 --- a/glib/tests/Makefile.am +++ b/glib/tests/Makefile.am @@ -1,8 +1,7 @@ -INCLUDES = -g -I$(top_srcdir) -I$(top_srcdir)/glib $(GLIB_DEBUG_FLAGS) +include $(top_srcdir)/Makefile.decl -GTESTER = $(top_builddir)/glib/gtester +INCLUDES = -g -I$(top_srcdir) -I$(top_srcdir)/glib $(GLIB_DEBUG_FLAGS) -TEST_PROGS = noinst_PROGRAMS = $(TEST_PROGS) progs_ldadd = $(top_builddir)/glib/libglib-2.0.la @@ -11,15 +10,6 @@ TEST_PROGS += testing testing_SOURCES = testing.c testing_LDADD = $(progs_ldadd) -# exemplary unit test rules -test: - ${GTESTER} --verbose ${TEST_PROGS} -test-report: - ${GTESTER} --verbose -k -o testreport.xml ${TEST_PROGS} -.PHONY: test test-report -check-local: test - - # some testing of gtester funcitonality XMLLINT=xmllint gtester-xmllint-check: # check testreport xml with xmllint if present diff --git a/glib/tests/testing.c b/glib/tests/testing.c index 3913f7909..77aa78732 100644 --- a/glib/tests/testing.c +++ b/glib/tests/testing.c @@ -174,10 +174,12 @@ main (int argc, g_test_add_func ("/random-generator/rand-2", test_rand2); g_test_add_func ("/misc/assertions", test_assertions); g_test_add ("/misc/primetoul", Fixturetest, fixturetest_setup, fixturetest_test, fixturetest_teardown); - g_test_add_func ("/misc/timer", test_timer); + if (g_test_perf()) + g_test_add_func ("/misc/timer", test_timer); g_test_add_func ("/forking/fail assertion", test_fork_fail); g_test_add_func ("/forking/patterns", test_fork_patterns); - g_test_add_func ("/forking/timeout", test_fork_timeout); + if (g_test_slow()) + g_test_add_func ("/forking/timeout", test_fork_timeout); return g_test_run(); } diff --git a/glib/update-pcre/Makefile.am b/glib/update-pcre/Makefile.am index ac7f82c11..b7f80c61f 100644 --- a/glib/update-pcre/Makefile.am +++ b/glib/update-pcre/Makefile.am @@ -1,4 +1,6 @@ -EXTRA_DIST = \ +include $(top_srcdir)/Makefile.decl + +EXTRA_DIST += \ update.sh \ Makefile.am-1 \ Makefile.am-2 \ diff --git a/gmodule/Makefile.am b/gmodule/Makefile.am index 84118bd9e..ab4b1f6a3 100644 --- a/gmodule/Makefile.am +++ b/gmodule/Makefile.am @@ -1,9 +1,10 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib -I$(top_srcdir)/gmodule \ -DG_LOG_DOMAIN=\"GModule\" @GLIB_DEBUG_FLAGS@ -DG_DISABLE_DEPRECATED -EXTRA_DIST = \ +EXTRA_DIST += \ makefile.msc.in \ gmoduleconf.h.in \ gmodule.def \ diff --git a/gobject/Makefile.am b/gobject/Makefile.am index 6721ed5d7..7dfb27689 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -2,6 +2,7 @@ # Copyright (C) 1997,98,99,2000 Tim Janik and Red Hat, Inc. # ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl INCLUDES = \ -DG_LOG_DOMAIN=\"GLib-GObject\" \ @@ -142,7 +143,7 @@ gobject_extra_sources = \ gobject_target_headers = $(gobject_public_h_sources) gobject_target_sources = $(gobject_c_sources) EXTRA_HEADERS = -EXTRA_DIST = \ +EXTRA_DIST += \ $(gobject_private_h_sources) \ $(gobject_extra_sources) \ makegobjectalias.pl \ diff --git a/gthread/Makefile.am b/gthread/Makefile.am index af8ea64b8..5d774d9a9 100644 --- a/gthread/Makefile.am +++ b/gthread/Makefile.am @@ -1,10 +1,11 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/Makefile.decl INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib -I$(top_srcdir)/gthread \ -DG_LOG_DOMAIN=\"GThread\" @GTHREAD_COMPILE_IMPL_DEFINES@ \ @GLIB_DEBUG_FLAGS@ -DG_DISABLE_DEPRECATED -EXTRA_DIST = \ +EXTRA_DIST += \ makefile.msc.in \ gthread-posix.c \ gthread-win32.c \ diff --git a/m4macros/Makefile.am b/m4macros/Makefile.am index bf2fa8f6a..0284b4e77 100644 --- a/m4macros/Makefile.am +++ b/m4macros/Makefile.am @@ -1,7 +1,8 @@ +include $(top_srcdir)/Makefile.decl installed_m4= glib-2.0.m4 glib-gettext.m4 -EXTRA_DIST=$(installed_m4) +EXTRA_DIST+=$(installed_m4) m4datadir = $(datadir)/aclocal m4data_DATA = $(installed_m4) diff --git a/tests/Makefile.am b/tests/Makefile.am index 5bed3e455..acc75702f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.decl + SUBDIRS=gobject refcount if ENABLE_REGEX @@ -31,7 +33,7 @@ spawn_test_win32_gui_LDFLAGS = -mwindows endif -EXTRA_DIST = \ +EXTRA_DIST += \ $(test_scripts) \ makefile.msc.in \ casefold.txt \ diff --git a/tests/gobject/Makefile.am b/tests/gobject/Makefile.am index d81c7e753..d6103664b 100644 --- a/tests/gobject/Makefile.am +++ b/tests/gobject/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.decl + INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/glib \ @@ -70,7 +72,7 @@ TESTS_ENVIRONMENT = srcdir=$(srcdir) \ ######################################################################## -EXTRA_DIST = \ +EXTRA_DIST += \ testmarshal.list BUILT_EXTRA_DIST = \ diff --git a/tests/refcount/Makefile.am b/tests/refcount/Makefile.am index bfb21c0fd..ff29b5989 100644 --- a/tests/refcount/Makefile.am +++ b/tests/refcount/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.decl + INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/glib \ |