Makefile.coq.local 1.18 KB
Newer Older
Ralf Jung's avatar
Ralf Jung committed
1 2
# Run tests interleaved with main build.  They have to be in the same target for this.
real-all: $(if $(NO_TEST),,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_OLD=$(shell echo "$(COQ_VERSION)" | egrep "^8\.7\b" -q && echo 1)
12
COQ_MINOR_VERSION=$(shell echo "$(COQ_VERSION)" | egrep '^[0-9]+\.[0-9]+\b' -o)
13

14
tests/.coqdeps.d: $(TESTFILES)
Ralf Jung's avatar
Ralf Jung committed
15
	$(SHOW)'COQDEP TESTFILES'
16 17
	$(HIDE)$(COQDEP) -dyndep var $(COQMF_COQLIBS_NOML) $^ $(redir_if_ok)
-include tests/.coqdeps.d
18

19
$(TESTFILES:.v=.vo): %.vo: %.v $(if $(MAKE_REF),,%.ref)
20
	$(HIDE)TEST="$$(basename -s .v $<)" && \
Ralf Jung's avatar
Ralf Jung committed
21 22 23 24 25
	  if test -f "tests/$$TEST.$(COQ_MINOR_VERSION).ref"; then \
	    REF="tests/$$TEST.$(COQ_MINOR_VERSION).ref"; \
	  else \
	    REF="tests/$$TEST.ref"; \
	  fi && \
Ralf Jung's avatar
Ralf Jung committed
26
	  echo "COQTEST$(if $(COQ_OLD), [no ref],$(if $(MAKE_REF), [make ref],)) $<$(if $(COQ_OLD),, (ref: $$REF))" && \
Ralf Jung's avatar
Ralf Jung committed
27
	  TMPFILE="$$(mktemp)" && \
28
	  $(TIMER) $(COQ_TEST) $(COQFLAGS) $(COQLIBS) -load-vernac-source $< > "$$TMPFILE" && \
Ralf Jung's avatar
Ralf Jung committed
29 30
	  $(if $(COQ_OLD),true, \
	    $(if $(MAKE_REF),mv "$$TMPFILE" "$$REF",diff -u "$$REF" "$$TMPFILE") \
31
	  ) && \
32
	  rm -f "$$TMPFILE" && \
33
	  touch $@