From 4f6fd86385c824b8e04d97d05a132646520dc3bf Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Sat, 20 Feb 2010 21:47:43 +0100 Subject: [PATCH] [tests] Merged Makefile.decl in the test framework Included Makefile.decl from glib-2.23.2 in build/Makefile.gtester and adapted for the ADG project. --- Makefile.am | 2 +- adg/Makefile.am | 2 +- build/Makefile.am.common | 2 ++ build/Makefile.am.gtester | 57 +++++++++++++++++++++++++++++++++++++++++++++++ build/Makefile.am.gtk-doc | 11 +++++---- configure.ac | 41 ++++++++++++++++++++++++++++++++++ cpml/Makefile.am | 2 +- docs/Makefile.am | 2 +- tests/Makefile.am | 10 ++++----- 9 files changed, 113 insertions(+), 16 deletions(-) create mode 100644 build/Makefile.am.gtester diff --git a/Makefile.am b/Makefile.am index 3b9ca740..e0b8299c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,7 +14,7 @@ BUILT_SOURCES= ChangeLog \ TODO \ CONTRIBUTING -EXTRA_DIST= COPYING \ +EXTRA_DIST+= COPYING \ ChangeLog-0.2.1 \ INSTALL \ THANKS \ diff --git a/adg/Makefile.am b/adg/Makefile.am index 9152d552..5e2a21e5 100644 --- a/adg/Makefile.am +++ b/adg/Makefile.am @@ -138,7 +138,7 @@ endif # targets pkgconfig_DATA= $(pkgconfig_file) -EXTRA_DIST= $(pkgconfig_file).in \ +EXTRA_DIST+= $(pkgconfig_file).in \ $(template_sources) BUILT_SOURCES= $(built_h_sources) \ $(built_private_h_sources) diff --git a/build/Makefile.am.common b/build/Makefile.am.common index 3a184e3f..23247202 100644 --- a/build/Makefile.am.common +++ b/build/Makefile.am.common @@ -8,3 +8,5 @@ abs_top_builddir=@abs_top_builddir@ pkgconfigdir=$(libdir)/pkgconfig MSG_GEN=echo ' GEN '$@; + +include $(top_srcdir)/build/Makefile.am.gtester diff --git a/build/Makefile.am.gtester b/build/Makefile.am.gtester new file mode 100644 index 00000000..aef85bf3 --- /dev/null +++ b/build/Makefile.am.gtester @@ -0,0 +1,57 @@ +## Adapted Makefile.decl found in glib-2.23.2 +EXTRA_DIST= +TEST_PROGS= + + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} +if OS_UNIX + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o \ + "$$subdir" = "po" -o \ + "$$subdir" = "po-properties" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +endif + +# 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 ; \ + echo '' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } + +.PHONY: test test-report perf-report full-report + +check-local: test diff --git a/build/Makefile.am.gtk-doc b/build/Makefile.am.gtk-doc index ce3e7bc2..477dfbea 100644 --- a/build/Makefile.am.gtk-doc +++ b/build/Makefile.am.gtk-doc @@ -23,12 +23,11 @@ GPATH = $(srcdir) TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) -EXTRA_DIST = \ - $(content_files) \ - $(HTML_IMAGES) \ - $(DOC_MAIN_SGML_FILE) \ - $(DOC_MODULE)-sections.txt \ - $(DOC_MODULE)-overrides.txt +EXTRA_DIST+= $(content_files) \ + $(HTML_IMAGES) \ + $(DOC_MAIN_SGML_FILE) \ + $(DOC_MODULE)-sections.txt \ + $(DOC_MODULE)-overrides.txt DOC_STAMPS=scan-build.stamp sgml-build.stamp html-build.stamp pdf-build.stamp \ $(srcdir)/sgml.stamp $(srcdir)/html.stamp \ diff --git a/configure.ac b/configure.ac index 69b57431..b6042833 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,45 @@ AC_CONFIG_MACRO_DIR([build]) AM_INIT_AUTOMAKE([1.6 gnits no-dist-gzip dist-bzip2 -Wall]) +# Check for host information + +AC_CANONICAL_HOST +case "${host}" in + *-*-linux*) + guessed_host=linux + ;; + *-*-freebsd*) + guessed_host=freebsd + ;; + *-*-mingw*) + guessed_host=mingw + ;; + *-*-solaris*) + guessed_host=solaris + ;; + *-*-darwin*) + guessed_host=darwin + ;; + *-*-beos*) + guessed_host=beos + ;; + *-*-cygwin*) + guessed_host=cygwin + ;; + *-*-minix) + guessed_host=minix + ;; + *-*-aix*) + guessed_host=aix + ;; + *) + guessed_host=unknown + ;; +esac +AM_CONDITIONAL([OS_UNIX],[test "${guessed_host}" != "mingw"]) +AM_CONDITIONAL([OS_WIN32],[test "${guessed_host}" == "mingw" -o "${guessed_host}" == "cygwin"]) + + # Check for programs AC_PROG_CC @@ -25,6 +64,8 @@ PKG_PROG_PKG_CONFIG AC_PATH_PROG([XSLTPROC],[xsltproc],[/usr/bin/xsltproc]) AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums],[/usr/bin/glib-mkenums]) AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal],[/usr/bin/glib-genmarshal]) +AC_PATH_PROG([GTESTER],[gtester],[/usr/bin/gtester]) +AC_PATH_PROG([GTESTER_REPORT],[gtester-report],[/usr/bin/gtester-report]) m4_ifdef([LT_INIT], [LT_INIT([disable-static])], diff --git a/cpml/Makefile.am b/cpml/Makefile.am index 1e89f40b..88b92aa0 100644 --- a/cpml/Makefile.am +++ b/cpml/Makefile.am @@ -51,4 +51,4 @@ libcpml_la_SOURCES= $(cpml_h_sources) \ $(cpml_c_sources) \ $(cpml_built_c_sources) pkgconfig_DATA= $(cpml_pkgconfig_file) -EXTRA_DIST= $(cpml_pkgconfig_file).in +EXTRA_DIST+= $(cpml_pkgconfig_file).in diff --git a/docs/Makefile.am b/docs/Makefile.am index 0a2d0118..aacc8fea 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -3,4 +3,4 @@ include $(top_srcdir)/build/Makefile.am.common SUBDIRS= cpml \ adg -EXTRA_DIST= gnu/docbook2txt.xsl +EXTRA_DIST+= gnu/docbook2txt.xsl diff --git a/tests/Makefile.am b/tests/Makefile.am index d25ffdf1..df867f1e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,21 +8,20 @@ LDADD= $(top_builddir)/adg/libadg.la # file groups -test_programs= test_internals= test-internal.c \ test-internal.h if HAVE_TEST_FRAMEWORK -test_programs+= test-model +TEST_PROGS+= test-model test_model_SOURCES= test-model.c \ $(test_internals) -test_programs+= test-edges +TEST_PROGS+= test-edges test_edges_SOURCES= test-edges.c \ $(test_internals) -test_programs+= test-entity +TEST_PROGS+= test-entity test_entity_SOURCES= test-entity.c \ $(test_internals) @@ -30,5 +29,4 @@ endif # targets -check_PROGRAMS= $(test_programs) -TESTS= $(test_programs) +noinst_PROGRAMS= $(TEST_PROGS) -- 2.11.4.GIT