build: Allow to run the tests from any directory
authorDamien Lespiau <damien.lespiau@intel.com>
Sun, 6 Jun 2010 21:47:02 +0000 (22:47 +0100)
committerRobert Bragg <robert@linux.intel.com>
Tue, 6 Jul 2010 11:39:15 +0000 (12:39 +0100)
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
tests/conform/.gitignore
tests/conform/Makefile.am
tests/conform/test-launcher.sh.in [moved from tests/conform/test-launcher.sh with 91% similarity]
tests/interactive/.gitignore
tests/interactive/Makefile.am
tests/interactive/wrapper.sh.in [moved from tests/interactive/wrapper.sh with 87% similarity]

index dc35b08..17fdb68 100644 (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
index f382db0..0418561 100644 (file)
@@ -1,4 +1,5 @@
 *.o
+/test-launcher.sh
 /stamp-test-conformance
 /test-anchors
 /test-cogl-backface-culling
index c56ce4d..0b6e433 100644 (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
similarity index 91%
rename from tests/conform/test-launcher.sh
rename to tests/conform/test-launcher.sh.in
index a96d2bb..0be13bd 100755 (executable)
@@ -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:"
index 20a77c2..a1d1e47 100644 (file)
@@ -1,4 +1,5 @@
 *.o
+/wrapper.sh
 /stamp-test-interactive
 /test-actor-clone
 /test-actors
index 80b7756..0b4d06f 100644 (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
 
similarity index 87%
rename from tests/interactive/wrapper.sh
rename to tests/interactive/wrapper.sh.in
index 6bae94c..90aa4e1 100755 (executable)
@@ -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 "$@"