build: Allow to run the tests from any directory

I was fed up to cd into the tests/conform or tests/interactive directories
to launch a specific test. Now, with the power the abs_ variants of
builddir and srcdir we can run specific test from any directory.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2159
This commit is contained in:
Damien Lespiau 2010-06-06 22:47:02 +01:00 committed by Robert Bragg
parent 739240095f
commit 1860d45087
7 changed files with 15 additions and 7 deletions

View File

@ -1029,8 +1029,10 @@ AC_CONFIG_FILES([
clutter/json/Makefile
tests/Makefile
tests/conform/Makefile
tests/conform/test-launcher.sh
tests/data/Makefile
tests/interactive/Makefile
tests/interactive/wrapper.sh
tests/micro-bench/Makefile
tests/tools/Makefile
doc/Makefile

View File

@ -1,4 +1,5 @@
*.o
/test-launcher.sh
/stamp-test-conformance
/test-anchors
/test-cogl-backface-culling

View File

@ -67,11 +67,12 @@ wrappers: stamp-test-conformance
@true
stamp-test-conformance: test-conformance$(EXEEXT)
@mkdir -p wrappers
@chmod +x test-launcher.sh
@for i in $(UNIT_TESTS); \
do \
unit=`basename $$i | sed -e s/_/-/g`; \
echo " GEN $$unit"; \
( echo "#!/bin/sh" ; echo "$(top_srcdir)/tests/conform/test-launcher.sh '$$i' \"\$$@\"" ) > $$unit$(EXEEXT) ; \
( echo "#!/bin/sh" ; echo "$(abs_builddir)/test-launcher.sh '$$i' \"\$$@\"" ) > $$unit$(EXEEXT) ; \
( echo "#!/bin/sh" ; echo "exec ./test-conformance$(EXEEXT) -p $$i \"\$$@\"" ) > wrappers/$$unit$(EXEEXT) ; \
chmod +x $$unit$(EXEEXT); \
chmod +x wrappers/$$unit$(EXEEXT); \
@ -177,7 +178,8 @@ full-report: full-report-generate
gnome-open "$$x"; \
done
EXTRA_DIST = ADDING_NEW_TESTS test-launcher.sh run-tests.sh
EXTRA_DIST = ADDING_NEW_TESTS test-launcher.sh.in run-tests.sh
DISTCLEANFILES = test-launcher.sh
# we override the clean-generic target to clean up the wrappers so
# we cannot use CLEANFILES

View File

@ -12,7 +12,7 @@ UNIT_TEST=`basename ${UNIT_TEST_PATH}`
echo "Running: ./test-conformance -p ${UNIT_TEST_PATH} $@"
echo ""
./test-conformance -p ${UNIT_TEST_PATH} "$@"
@abs_builddir@/test-conformance -p ${UNIT_TEST_PATH} "$@"
echo ""
echo "NOTE: For debugging purposes, you can run this single test as follows:"

View File

@ -1,4 +1,5 @@
*.o
/wrapper.sh
/stamp-test-interactive
/test-actor-clone
/test-actors

View File

@ -65,7 +65,8 @@ endif
wrappers: stamp-test-interactive
@true
stamp-test-interactive: test-interactive$(EXEEXT)
@wrapper=$(top_srcdir)/tests/interactive/wrapper.sh ; \
@wrapper=$(abs_builddir)/wrapper.sh ; \
chmod +x $$wrapper && \
for i in $(UNIT_TESTS); \
do \
test_bin=$${i%*.c} ; \
@ -102,12 +103,13 @@ noinst_PROGRAMS = test-interactive
test_interactive_SOURCES = test-main.c $(UNIT_TESTS)
test_interactive_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
test_interactive_CPPFLAGS = \
-DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \
-DTESTS_DATADIR=\""$(abs_top_srcdir)/tests/data"\" \
-DG_DISABLE_SINGLE_INCLUDES
test_interactive_LDFLAGS = -export-dynamic
test_interactive_LDADD = $(CLUTTER_LIBS) $(common_ldadd)
EXTRA_DIST = wrapper.sh
EXTRA_DIST = wrapper.sh.in
DISTCLEANFILES = wrapper.sh
BUILT_SOURCES = wrappers

View File

@ -11,5 +11,5 @@ echo "$ libtool --mode=execute \\"
echo " gdb --eval-command=\"b `echo $UNIT_TEST|tr '-' '_'`_main\" \\"
echo " --args ./test-interactive $UNIT_TEST"
./test-interactive $UNIT_TEST "$@"
@abs_builddir@/test-interactive $UNIT_TEST "$@"