diff --git a/Makefile.am b/Makefile.am index c56e672..40bcea2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,6 +61,7 @@ do_subst = sed \ -e 's,[@]GODIR[@],$(guileobjectdir),g' scripts/gash: scripts/gash.in Makefile + mkdir -p scripts $(do_subst) < $(srcdir)/scripts/gash.in > scripts/gash chmod a+x scripts/gash @@ -83,7 +84,7 @@ EXTRA_DIST += \ TEST_EXTENSIONS = .scm .sh SCM_LOG_COMPILER = $(top_builddir)/pre-inst-env $(GUILE) AM_SCM_LOG_FLAGS = --no-auto-compile -SH_LOG_COMPILER = $(top_builddir)/pre-inst-env $(top_builddir)/test.sh +SH_LOG_COMPILER = $(top_builddir)/pre-inst-env $(top_srcdir)/test.sh .PHONY: check-spec check-spec: diff --git a/test.sh b/test.sh index 8fa4fb8..db2f3c5 100755 --- a/test.sh +++ b/test.sh @@ -3,23 +3,31 @@ if [ -n "$V" ]; then set -x fi DIFF=${DIFF-diff} -TEST_SHELL=${TEST_SHELL-scripts/gash} +TEST_SHELL=${TEST_SHELL-gash} t="$1" -b=tests/$(basename "$t" .sh) +s=tests/$(basename "$t" .sh) + +# This is a hack to make sure we can build from an external directory. +# We move into the source directory, and then send all of our output +# back to the build directory. +export TEST_TMP=$(pwd) +b=$(pwd)/$s +cd $(dirname "$t")/.. + set +e -timeout 10 $TEST_SHELL -e "$b".sh -s --long file0 file1 > "$b".1 2> "$b".2 +timeout 10 $TEST_SHELL -e "$s".sh -s --long file0 file1 > "$b".1 2> "$b".2 r=$? set -e -if [ -f "$b".exit ]; then - e=$(cat "$b".exit) +if [ -f "$s".exit ]; then + e=$(cat "$s".exit) else e=0 fi [ $r = $e ] || exit 1 -if [ -f "$b".stdout ]; then - $DIFF -u "$b".stdout $b.1 +if [ -f "$s".stdout ]; then + $DIFF -u "$s".stdout $b.1 fi -if [ -f "$b".stderr ]; then - $DIFF -u "$b".stderr "$b".2 +if [ -f "$s".stderr ]; then + $DIFF -u "$s".stderr "$b".2 fi diff --git a/tests/50-redirect-append.sh b/tests/50-redirect-append.sh index c6c8db9..4bbbbc3 100644 --- a/tests/50-redirect-append.sh +++ b/tests/50-redirect-append.sh @@ -1,4 +1,4 @@ -echo foo > bar -echo foo >> bar -cat bar -rm bar +echo foo > $TEST_TMP/bar +echo foo >> $TEST_TMP/bar +cat $TEST_TMP/bar +rm $TEST_TMP/bar diff --git a/tests/60-subst.sh b/tests/60-subst.sh index ae8ba25..271d6f0 100644 --- a/tests/60-subst.sh +++ b/tests/60-subst.sh @@ -4,6 +4,6 @@ subst () { $1 > $2 } -subst tests/data/foo foo.tmp -cat foo.tmp -rm foo.tmp +subst tests/data/foo $TEST_TMP/foo.tmp +cat $TEST_TMP/foo.tmp +rm $TEST_TMP/foo.tmp