summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-10-25 06:06:42 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-10-25 06:06:42 -0700
commitf41c10e5385c47161ffd2ced05e2c7f3f1a8caff (patch)
tree0346d60919540b24f634694e0ea68d616aab5eb5
parent2a2a53e9277014df4c4ca11fbd752ea515086220 (diff)
downloadtxr-f41c10e5385c47161ffd2ced05e2c7f3f1a8caff.tar.gz
txr-f41c10e5385c47161ffd2ced05e2c7f3f1a8caff.tar.bz2
txr-f41c10e5385c47161ffd2ced05e2c7f3f1a8caff.zip
Makefile: fix silliness in "tests" target.
Last I addressed this, I didn't get it quite right. The problem is that the .out files are being removed when a test fails, which is annoying. The whole redirection of test results to a temp file which is then renamed is silly. Now, the .out files are preserved. Whether or not a test passed depends on whether or not the .ok stamp file is created or updated, so it doesn't matter whether an .out file exists or not. Also, tests are made dependent on the executable, and on the .expected files. If the executable is newer than the test outputs, all the tests will re-run. Also, if any .expected file is touched, the corresponding test will be re-run. * Makefile (clean): Do not remove $(TESTS_TMP). (TESTS_TMP): Variable removed. (tst/%.out): In both rules that run the test and make .out files simply redirect the output directly to the .out file represented as the $@ target. This is how it was before, once upon a time. (%.ok): Do not remove the .out file represdented by $< if the test fails; it is sufficient not to create/touch the .ok stamp file.
-rw-r--r--Makefile15
1 files changed, 5 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 0128f2e8..08eb57c6 100644
--- a/Makefile
+++ b/Makefile
@@ -314,13 +314,11 @@ clean: conftest.clean tests.clean
rm -f y.tab.h.old
rm -f $(PROG)-win$(EXE) $(PROG)-win-dbg$(EXE)
rm -rf opt dbg $(EXTRA_OBJS-y)
- rm -f $(TESTS_TMP)
distclean: clean
rm -f config.h config.make config.log
endif
-TESTS_TMP := txr.test.out
TESTS_OUT := $(addprefix tst/,\
$(patsubst %.tl,%.out,\
$(patsubst %.txr,%.out,\
@@ -364,27 +362,24 @@ tst/tests/016/%: TXR_DBG_OPTS :=
tst/tests/017/%: TXR_DBG_OPTS :=
.PRECIOUS: tst/%.out
-tst/%.out: %.txr
+tst/%.out: %.txr %.expected $(TXR)
$(call ABBREV,TXR)
$(call SH,mkdir -p $(dir $@))
$(call SH, \
$(if $(TXR_SCRIPT_ON_CMDLINE), \
$(TXR) $(TXR_DBG_OPTS) $(TXR_OPTS) -c "$$(cat $<)" \
- $(TXR_ARGS) > $(TESTS_TMP), \
- $(TXR) $(TXR_DBG_OPTS) $(TXR_OPTS) $< $(TXR_ARGS) > $(TESTS_TMP)))
- $(call SH,mv $(TESTS_TMP) $@)
+ $(TXR_ARGS) > $@, \
+ $(TXR) $(TXR_DBG_OPTS) $(TXR_OPTS) $< $(TXR_ARGS) > $@))
-tst/%.out: %.tl
+tst/%.out: %.tl %.expected $(TXR)
$(call ABBREV,TXR)
$(call SH,mkdir -p $(dir $@))
$(call SH,\
- $(TXR) $(TXR_DBG_OPTS) $(TXR_OPTS) $< $(TXR_ARGS) > $(TESTS_TMP))
- $(call SH,mv $(TESTS_TMP) $@)
+ $(TXR) $(TXR_DBG_OPTS) $(TXR_OPTS) $< $(TXR_ARGS) > $@)
%.ok: %.out
$(call SH, \
if ! diff -u $(patsubst tst/%.out,%.expected,$<) $< ; then \
- rm $< ; \
exit 1 ; \
fi)
$(call SH,touch $@)