Newer
Older
# run tests after real-all
post-all:: test
# the test suite
TESTFILES=$(wildcard tests/*.v)
test: $(TESTFILES:.v=.vo)
.PHONY: test
COQ_TEST=$(COQTOP) $(COQDEBUG) -batch -test-mode
REF_FILTER=egrep -v '(^Welcome to Coq|^Skipping rcfile loading.$$)'
# Can't use pipes because that discards error codes and dash provides no way to control that.
# Also egrep errors if it doesn't match anything, we have to ignore that.
# Oh Unix...
$(TESTFILES:.v=.vo): %.vo: %.v $(VFILES:.v=.vo)
$(HIDE)TEST="$$(basename -s .v $<)" && \
$(TIMER) $(COQ_TEST) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) -load-vernac-source $< $(TIMING_EXTRA) > "$$TMPFILE" && \
($(REF_FILTER) < "$$TMPFILE" > "$$TMPFILE.filtered" || true) && \
(diff -u "tests/$$TEST.ref" "$$TMPFILE.filtered" || rm -f "tests/$$TEST.vo" "$$TMPFILE" "$$TMPFILE.filtered") && \
rm "$$TMPFILE" "$$TMPFILE.filtered"
# a target, for convenience sake, to create the .ref file with the current output
ref: $(TESTFILES:.v=.ref)
.PHONY: ref
tests/%.ref: tests/%.v $(VFILES:.v=.vo)
$(HIDE)TEST="$$(basename -s .v $<)" && \
$(TIMER) $(COQ_TEST) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) -load-vernac-source $< $(TIMING_EXTRA) > "tests/$$TEST.ref" && \
($(REF_FILTER) < "tests/$$TEST.ref" > "tests/$$TEST.ref.filtered" || true) && \
mv "tests/$$TEST.ref.filtered" "tests/$$TEST.ref"