From 1860d45087f85a956e21ce69631b9a1cf0e7436f Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Sun, 6 Jun 2010 22:47:02 +0100 Subject: [PATCH] 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 --- configure.ac | 2 ++ tests/conform/.gitignore | 1 + tests/conform/Makefile.am | 6 ++++-- tests/conform/{test-launcher.sh => test-launcher.sh.in} | 2 +- tests/interactive/.gitignore | 1 + tests/interactive/Makefile.am | 8 +++++--- tests/interactive/{wrapper.sh => wrapper.sh.in} | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-) rename tests/conform/{test-launcher.sh => test-launcher.sh.in} (91%) rename tests/interactive/{wrapper.sh => wrapper.sh.in} (87%) diff --git a/configure.ac b/configure.ac index dc35b08c5..17fdb6813 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/tests/conform/.gitignore b/tests/conform/.gitignore index f382db05e..041856120 100644 --- a/tests/conform/.gitignore +++ b/tests/conform/.gitignore @@ -1,4 +1,5 @@ *.o +/test-launcher.sh /stamp-test-conformance /test-anchors /test-cogl-backface-culling diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am index c56ce4d77..0b6e4336a 100644 --- a/tests/conform/Makefile.am +++ b/tests/conform/Makefile.am @@ -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 diff --git a/tests/conform/test-launcher.sh b/tests/conform/test-launcher.sh.in similarity index 91% rename from tests/conform/test-launcher.sh rename to tests/conform/test-launcher.sh.in index a96d2bb8c..0be13bda5 100755 --- a/tests/conform/test-launcher.sh +++ b/tests/conform/test-launcher.sh.in @@ -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:" diff --git a/tests/interactive/.gitignore b/tests/interactive/.gitignore index 20a77c212..a1d1e4765 100644 --- a/tests/interactive/.gitignore +++ b/tests/interactive/.gitignore @@ -1,4 +1,5 @@ *.o +/wrapper.sh /stamp-test-interactive /test-actor-clone /test-actors diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am index 80b77565f..0b4d06fac 100644 --- a/tests/interactive/Makefile.am +++ b/tests/interactive/Makefile.am @@ -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 diff --git a/tests/interactive/wrapper.sh b/tests/interactive/wrapper.sh.in similarity index 87% rename from tests/interactive/wrapper.sh rename to tests/interactive/wrapper.sh.in index 6bae94c21..90aa4e1b6 100755 --- a/tests/interactive/wrapper.sh +++ b/tests/interactive/wrapper.sh.in @@ -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 "$@"