build: Ensure tests are built only on make check

Tests should only be enabled when we want to run them, or when we are
generating a tarball.
This commit is contained in:
Emmanuele Bassi 2013-08-16 10:57:54 +01:00
parent b50e1c3b62
commit fa72540246
6 changed files with 47 additions and 86 deletions

View File

@ -1,14 +1,3 @@
SUBDIRS = accessibility data conform interactive micro-bench performance
EXTRA_DIST = README
test conform:
( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$?
test-report full-report:
( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$?
.PHONY: test conform test-report full-report
# run make test as part of make check
check-local: test

View File

@ -7,18 +7,20 @@ common_sources = \
cally-examples-util.c \
cally-examples-util.h
INCLUDES = \
AM_CPPFLAGS = \
-DPREFIXDIR=\"$(libdir)\" \
-DCLUTTER_DISABLE_DEPRECATION_WARNINGS \
-DGLIB_DISABLE_DEPRECATION_WARNINGS \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/clutter \
-I$(top_builddir)/clutter \
-I$(top_srcdir)/tests/accessibility
AM_CPPFLAGS = -DPREFIXDIR=\"$(libdir)\" -DCLUTTER_DISABLE_DEPRECATION_WARNINGS -DGLIB_DISABLE_DEPRECATION_WARNINGS
AM_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
LDADD = $(common_ldadd) $(CLUTTER_LIBS)
noinst_PROGRAMS = \
check_PROGRAMS = \
cally-atkcomponent-example \
cally-atkeditabletext-example \
cally-atkevents-example \

View File

@ -2,7 +2,16 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
noinst_PROGRAMS = test-conformance
BUILT_SOURCES =
TESTS =
check_PROGRAMS =
check_SCRIPTS =
EXTRA_DIST =
DISTCLEANFILES =
TEST_PROGS =
# the common sources
common_sources = \
@ -71,14 +80,15 @@ units_sources += \
events-touch.c \
$(NULL)
test_conformance_SOURCES = $(common_sources) $(units_sources)
if OS_WIN32
SHEXT =
else
SHEXT = $(EXEEXT)
endif
EXTRA_DIST += ADDING_NEW_TESTS test-launcher.sh.in run-tests.sh
DISTCLEANFILES += test-launcher.sh .gitignore
# For convenience, this provides a way to easily run individual unit tests:
.PHONY: wrappers clean-wrappers
@ -101,6 +111,7 @@ stamp-test-conformance: Makefile $(srcdir)/test-conform-main.c
echo "*.html" ; \
echo "*.test" ; \
echo ".gitignore" ; \
echo "test-suite.log" ; \
echo "unit-tests" ; \
echo "/wrappers/" ) > .gitignore
@for i in `cat unit-tests`; \
@ -118,22 +129,20 @@ stamp-test-conformance: Makefile $(srcdir)/test-conform-main.c
&& echo timestamp > $(@F)
clean-wrappers:
@for i in `cat unit-tests`; \
@if test -f "unit-tests"; then \
for i in `cat unit-tests`; \
do \
unit=`basename $$i | sed -e s/_/-/g`; \
echo " RM $$unit"; \
rm -f $$unit$(SHEXT) ; \
rm -f wrappers/$$unit$(SHEXT) ; \
done \
&& rmdir wrappers \
fi \
&& rm -rf wrappers \
&& rm -f unit-tests \
&& rm -f $(top_builddir)/build/win32/*.bat \
&& rm -f stamp-test-conformance
# NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting
# a phony rule that will generate symlink scripts for running individual tests
BUILT_SOURCES = wrappers
test_conformance_CPPFLAGS = \
-DG_DISABLE_SINGLE_INCLUDES \
-DCOGL_ENABLE_EXPERIMENTAL_API \
@ -147,10 +156,17 @@ test_conformance_CPPFLAGS = \
-I$(top_builddir)/clutter
test_conformance_CFLAGS = -g $(CLUTTER_CFLAGS)
test_conformance_LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS) -lm
test_conformance_LDFLAGS = -export-dynamic
test_conformance_SOURCES = $(common_sources) $(units_sources)
if OS_WIN32
TESTS += test-conformance
endif
TEST_PROGS += test-conformance
check_PROGRAMS += test-conformance
check_SCRIPTS += wrappers
test: wrappers
@export G_TEST_SRCDIR="$(abs_srcdir)" ; \
@ -164,16 +180,13 @@ test-verbose: wrappers
$(top_srcdir)/tests/conform/run-tests.sh \
./test-conformance$(EXEEXT) -o test-report.xml --verbose
GTESTER = gtester
GTESTER_REPORT = gtester-report
# XXX: we could prevent the conformance test suite from running
# by simply defining this variable conditionally
TEST_PROGS = test-conformance
.PHONY: test
.PHONY: test-report perf-report full-report
.PHONY: test-report-npot perf-report-npot full-report-npot
check-local: test
GTESTER = gtester
GTESTER_REPORT = gtester-report
# test-report: run tests and generate report
# perf-report: run tests with -m perf and generate report
@ -216,47 +229,6 @@ test-report perf-report full-report: ${TEST_PROGS}
rm -rf "$$GTESTER_LOGDIR" ; \
}
# same as above, but with a wrapper that forcibly disables non-power of
# two textures
test-report-npot perf-report-npot full-report-npot: ${TEST_PROGS}
@test -z "${TEST_PROGS}" || { \
export COGL_DEBUG="$COGL_DEBUG,disable-npot-textures"; \
export GTESTER_LOGDIR=`mktemp -d "$(srcdir)/.testlogs-XXXXXX"` ; \
if test -d "$(top_srcdir)/.git"; then \
export REVISION="`git describe`" ; \
else \
export REVISION="$(VERSION) $(CLUTTER_RELEASE_STATUS)" ; \
fi ; \
export TIMESTAMP=`date +%Y-%m-%dT%H:%M:%S%z` ; \
case $@ in \
test-report-npot) test_options="-k";; \
perf-report-npot) test_options="-k -m=perf";; \
full-report-npot) test_options="-k -m=perf -m=slow";; \
esac ; \
export G_TEST_SRCDIR="$(abs_srcdir)" ; \
export G_TEST_BUILDDIR="$(abs_builddir)" ; \
$(top_srcdir)/tests/conform/run-tests.sh \
./test-conformance$(EXEEXT) \
--verbose \
$$test_options \
-o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ; \
echo '<?xml version="1.0"?>' > $@.xml ; \
echo '<report-collection>' >> $@.xml ; \
echo '<info>' >> $@.xml ; \
echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
echo ' <version>$(VERSION)</version>' >> $@.xml ; \
echo " <revision>$$REVISION</revision>" >> $@.xml ; \
echo " <date>$$TIMESTAMP</date>" >> $@.xml ; \
echo '</info>' >> $@.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 ; \
${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
rm -rf "$$GTESTER_LOGDIR" ; \
}
XML_REPORTS = \
test-report.xml \
perf-report.xml \
@ -273,9 +245,6 @@ HTML_REPORTS = \
perf-report-npot.html \
full-report-npot.html
EXTRA_DIST = ADDING_NEW_TESTS test-launcher.sh.in run-tests.sh
DISTCLEANFILES = test-launcher.sh .gitignore
dist-hook: $(top_builddir)/build/win32/vs9/test-conformance-clutter.vcproj $(top_builddir)/build/win32/vs10/test-conformance-clutter.vcxproj $(top_builddir)/build/win32/vs10/test-conformance-clutter.vcxproj.filters
$(top_builddir)/build/win32/vs9/test-conformance-clutter.vcproj: $(top_srcdir)/build/win32/vs9/test-conformance-clutter.vcprojin

View File

@ -67,7 +67,7 @@ SHEXT = $(EXEEXT)
endif
# For convenience, this provides a way to easily run individual unit tests:
wrappers: stamp-test-interactive $(top_builddir)/build/win32/test-interactive-clutter.bat
wrappers: stamp-test-interactive
@true
stamp-test-interactive: Makefile
@ -91,7 +91,7 @@ stamp-test-interactive: Makefile
done \
&& echo timestamp > $(@F)
$(top_builddir)/build/win32/test-interactive-clutter.bat: Makefile test-interactive$(EXEEXT)
$(top_builddir)/build/win32/test-interactive-clutter.bat: Makefile
@echo " GEN test-interactive-clutter.bat" ; \
for i in $(UNIT_TESTS); \
do \
@ -138,7 +138,8 @@ clean-wrappers:
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la
noinst_PROGRAMS = test-interactive
check_PROGRAMS = test-interactive
check_SCRIPTS = wrappers $(top_builddir)/build/win32/test-interactive-clutter.bat
test_interactive_SOURCES = test-main.c $(UNIT_TESTS)
nodist_test_interactive_SOURCES = test-unit-names.h
@ -162,7 +163,7 @@ EXTRA_DIST = \
DISTCLEANFILES = wrapper.sh .gitignore test-unit-names.h
BUILT_SOURCES = test-unit-names.h wrappers
BUILT_SOURCES = test-unit-names.h
dist-hook: $(top_builddir)/build/win32/vs9/test-interactive-clutter.vcproj $(top_builddir)/build/win32/vs10/test-interactive-clutter.vcxproj $(top_builddir)/build/win32/vs10/test-interactive-clutter.vcxproj.filters

View File

@ -2,7 +2,7 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la
noinst_PROGRAMS = \
check_PROGRAMS = \
test-text \
test-picking \
test-text-perf \

View File

@ -1,6 +1,6 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
noinst_PROGRAMS = \
check_PROGRAMS = \
test-picking \
test-text-perf \
test-state \