diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-10-25 06:06:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-10-25 06:06:42 -0700 |
commit | e785a27f51b43a35ab2ef3852f3be539f1a45ee3 (patch) | |
tree | 0346d60919540b24f634694e0ea68d616aab5eb5 /Makefile | |
parent | 68cb7ad16369d196e230200b6e43659e27b8c45e (diff) | |
download | txr-e785a27f51b43a35ab2ef3852f3be539f1a45ee3.tar.gz txr-e785a27f51b43a35ab2ef3852f3be539f1a45ee3.tar.bz2 txr-e785a27f51b43a35ab2ef3852f3be539f1a45ee3.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.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -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 $@) |