Makefile.coq.local 1.3 KB
Newer Older
1 2
# run tests with main build
real-all: test
3 4 5 6 7 8 9

# the test suite
TESTFILES=$(wildcard tests/*.v)

test: $(TESTFILES:.v=.vo)
.PHONY: test

10
COQ_TEST=$(COQTOP) $(COQDEBUG) -batch -test-mode
11
COQ_BROKEN=$(shell echo "$(COQ_VERSION)" | egrep "^8\.9" > /dev/null && echo 1)
12 13 14 15

# 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...
16 17 18
REF_FILTER=egrep -v '(^Welcome to Coq|^Skipping rcfile loading.$$)'

tests/.coqdeps.d: $(TESTFILES)
Ralf Jung's avatar
Ralf Jung committed
19
	$(SHOW)'COQDEP TESTFILES'
20 21
	$(HIDE)$(COQDEP) -dyndep var $(COQMF_COQLIBS_NOML) $^ $(redir_if_ok)
-include tests/.coqdeps.d
22

23
$(TESTFILES:.v=.vo): %.vo: %.v $(if $(MAKE_REF),,%.ref)
24
	$(SHOW)$(if $(COQ_BROKEN),COQTEST [ignore],$(if $(MAKE_REF),COQTEST [ref],COQTEST)) $<
25
	$(HIDE)TEST="$$(basename -s .v $<)" && \
Ralf Jung's avatar
Ralf Jung committed
26
	  TMPFILE="$$(mktemp)" && \
27
	  $(TIMER) $(COQ_TEST) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) -load-vernac-source $< $(TIMING_EXTRA) > "$$TMPFILE" && \
28
	  ($(REF_FILTER) < "$$TMPFILE" > "$$TMPFILE.filtered" || true) && \
29 30 31 32 33 34
	  $(if $(COQ_BROKEN), true, \
	    $(if $(MAKE_REF), \
	      mv "$$TMPFILE.filtered" "tests/$$TEST.ref", \
	      diff -u "tests/$$TEST.ref" "$$TMPFILE.filtered" \
            ) \
          ) && \
35
	  rm -f "$$TMPFILE" "$$TMPFILE.filtered" && \
36
	  touch $@