summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog27
-rw-r--r--Makefile73
-rwxr-xr-xconfigure10
3 files changed, 69 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b50a298..76940942 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,32 @@
2014-12-09 Kaz Kylheku <kaz@kylheku.com>
+ Test output goes to tst/ now.
+
+ * Makefile (TESTS_OUT): We don't need to refer to top_srcdir.
+ Add the tst/ prefix to .out paths. Find must be used with -H
+ because tests is a symlink for out-of-tree build directories.
+ (tests/*): All target-specific assignments are moved to tst/tests/*
+ paths, and top_srcdir is no longer used in the right hand side
+ values.
+ (%.out): Becomes (tst/%.out).
+ (%.ok): need to compute .expected name from .out differently to
+ account for tst/ prefix.
+ (tests.clean): Just remove the tst directory.
+ (install-tests): Remove the tst directory first so test commands
+ are forced to run (though it is a dry run).
+ We no longer need to switch to top_srcdir to find the .txr
+ files, nor do we have to filter out .out files from the tests
+ tree. We no longer have to switch to top_srcdir in the recursive
+ make. Also, show the installation of tests using ABBREV3.
+
+ * configure: When configuring in a separate directory, symlink
+ the tests directory back to the source tree. Since there
+ are now three things being symlinked, rewrote that as a loop.
+ The recommendation to build in a separate directory is just a note, not
+ a warning.
+
+2014-12-09 Kaz Kylheku <kaz@kylheku.com>
+
* Makefile (($TESTS_OUT)): Do not depend on $(PROG).
This adds superfluous commands to run.sh under make install-tests,
and is also inappropriate if a different txr binary is being tested.
diff --git a/Makefile b/Makefile
index cf422c2d..f2abb4f1 100644
--- a/Makefile
+++ b/Makefile
@@ -152,41 +152,42 @@ depend:
txr $(top_srcdir)/depend.txr $(OPT_OBJS) $(DBG_OBJS) > $(top_srcdir)/dep.mk
TESTS_TMP := txr.test.out
-TESTS_OUT := $(patsubst $(top_srcdir)/%.txr,./%.out,\
- $(shell find $(top_srcdir)/tests -name '*.txr' | sort))
+TESTS_OUT := $(addprefix tst/,\
+ $(patsubst %.txr,%.out,\
+ $(shell find -H tests -name '*.txr' | sort)))
TESTS_OK := $(TESTS_OUT:.out=.ok)
.PHONY: tests
tests: $(TESTS_OK)
$(V)echo "** tests passed!"
-tests/001/%: TXR_ARGS := $(top_srcdir)/tests/001/data
-tests/001/query-1.out: TXR_OPTS := -B
-tests/001/query-2.out: TXR_OPTS := -B
-tests/001/query-4.out: TXR_OPTS := -B
-tests/002/%: TXR_OPTS := -DTESTDIR=$(top_srcdir)/tests/002
-tests/004/%: TXR_ARGS := -a 123 -b -c
-tests/005/%: TXR_ARGS := $(top_srcdir)/tests/005/data
-tests/005/%: TXR_OPTS := -B
-tests/006/%: TXR_ARGS := $(top_srcdir)/tests/006/data
-tests/006/%: TXR_OPTS := -B
-tests/006/freeform-3.out: TXR_ARGS := $(top_srcdir)/tests/006/passwd
-tests/008/tokenize.out: TXR_ARGS := $(top_srcdir)/tests/008/data
-tests/008/configfile.out: TXR_ARGS := $(top_srcdir)/tests/008/configfile
-tests/008/students.out: TXR_ARGS := $(top_srcdir)/tests/008/students.xml
-tests/008/soundex.out: TXR_ARGS := soundex sowndex lloyd lee jackson robert
-tests/008/filtenv.out: TXR_OPTS := -B
-tests/009/json.out: TXR_ARGS := $(addprefix $(top_srcdir)/tests/009/,webapp.json pass1.json)
-tests/010/align-columns.out: TXR_ARGS := $(top_srcdir)/tests/010/align-columns.dat
-tests/010/block.out: TXR_OPTS := -B
-tests/010/reghash.out: TXR_OPTS := -B
-
-tests/002/%: TXR_SCRIPT_ON_CMDLINE := y
-
-tests/011/%: TXR_DBG_OPTS :=
-
-.PRECIOUS: %.out
-%.out: %.txr
+tst/tests/001/%: TXR_ARGS := tests/001/data
+tst/tests/001/query-1.out: TXR_OPTS := -B
+tst/tests/001/query-2.out: TXR_OPTS := -B
+tst/tests/001/query-4.out: TXR_OPTS := -B
+tst/tests/002/%: TXR_OPTS := -DTESTDIR=tests/002
+tst/tests/004/%: TXR_ARGS := -a 123 -b -c
+tst/tests/005/%: TXR_ARGS := tests/005/data
+tst/tests/005/%: TXR_OPTS := -B
+tst/tests/006/%: TXR_ARGS := tests/006/data
+tst/tests/006/%: TXR_OPTS := -B
+tst/tests/006/freeform-3.out: TXR_ARGS := tests/006/passwd
+tst/tests/008/tokenize.out: TXR_ARGS := tests/008/data
+tst/tests/008/configfile.out: TXR_ARGS := tests/008/configfile
+tst/tests/008/students.out: TXR_ARGS := tests/008/students.xml
+tst/tests/008/soundex.out: TXR_ARGS := soundex sowndex lloyd lee jackson robert
+tst/tests/008/filtenv.out: TXR_OPTS := -B
+tst/tests/009/json.out: TXR_ARGS := $(addprefix tests/009/,webapp.json pass1.json)
+tst/tests/010/align-columns.out: TXR_ARGS := tests/010/align-columns.dat
+tst/tests/010/block.out: TXR_OPTS := -B
+tst/tests/010/reghash.out: TXR_OPTS := -B
+
+tst/tests/002/%: TXR_SCRIPT_ON_CMDLINE := y
+
+tst/tests/011/%: TXR_DBG_OPTS :=
+
+.PRECIOUS: tst/%.out
+tst/%.out: %.txr
$(call ABBREV,TXR)
$(V)mkdir -p $(dir $@)
$(V)$(if $(TXR_SCRIPT_ON_CMDLINE),\
@@ -196,7 +197,7 @@ tests/011/%: TXR_DBG_OPTS :=
$(V)mv $(TESTS_TMP) $@
%.ok: %.out
- $(V)diff -u $(top_srcdir)/$(<:.out=.expected) $<
+ $(V)diff -u $(patsubst tst/%.out,%.expected,$<) $<
$(V)touch $@
%.expected: %.out
@@ -204,7 +205,7 @@ tests/011/%: TXR_DBG_OPTS :=
.PHONY: tests.clean
tests.clean:
- rm -f $(TESTS_TMP) $(TESTS_OUT) $(TESTS_OK)
+ rm -rf tst
define GREP_CHECK
$(V)if [ $$(grep -E $(1) $(SRCS) | wc -l) -ne $(3) ] ; then \
@@ -269,15 +270,15 @@ zip: install
# Install the tests as well as the script to run them
#
install-tests:
+ $(V)rm -rf tst
$(V)mkdir -p $(DESTDIR)$(datadir)
- $(V)(cd $(top_srcdir) ; \
- find tests -name '*.out' -prune -o -print \
- | cpio -co 2> /dev/null) \
- | (cd $(DESTDIR)$(datadir) ; cpio -idu 2> /dev/null)
+ $(call ABBREV3,INSTALL,$(DESTDIR)$(datadir),tests)
+ $(V)(find tests | cpio -co 2> /dev/null) \
+ | (cd $(DESTDIR)$(datadir) ; cpio -idu 2> /dev/null)
$(V)(echo "#!/bin/sh" ; \
echo "set -ex" ; \
echo "cd $(datadir)" ; \
- make -C $(top_srcdir) -s -n tests VERBOSE=y TXR=$(bindir)/txr) \
+ make -s -n tests VERBOSE=y TXR=$(bindir)/txr) \
> run.sh
$(call INSTALL,0755,run.sh,$(DESTDIR)$(datadir)/tests)
diff --git a/configure b/configure
index 9bef1060..8b6e4d7a 100755
--- a/configure
+++ b/configure
@@ -549,12 +549,12 @@ case "$top_srcdir" in
esac
if [ "$source_dir" != "." ] ; then
- printf "Symlinking Makefile -> $source_dir/Makefile\n"
- ln -sf "$source_dir/Makefile" .
- printf "Symlinking share -> $source_dir/share\n"
- ln -sf "$source_dir/share" .
+ for x in Makefile share tests; do
+ printf "Symlinking %s -> $source_dir/%s\n" $x $x
+ ln -sf "$source_dir/$x" .
+ done
else
- printf "Warning: its recommended to build in a separate directory\n"
+ printf "** Note: its recommended to build in a separate directory\n"
fi
gen_config_make()