Makefile.coq.local 1.34 KB
Newer Older
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

# the test suite
TESTFILES=$(wildcard tests/*.v)
6
NORMALIZER=test-normalizer.sed
7 8 9 10

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

11
COQ_TEST=$(COQTOP) $(COQDEBUG) -batch -test-mode
12 13
# FIXME: temporarily disabled on Coq master to help them land a patch
COQ_OLD=$(shell echo "$(COQ_VERSION)" | egrep "^8\.(7|11)\b" -q && echo 1)
14
COQ_MINOR_VERSION=$(shell echo "$(COQ_VERSION)" | egrep '^[0-9]+\.[0-9]+\b' -o)
15

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

21
$(TESTFILES:.v=.vo): %.vo: %.v $(if $(MAKE_REF),,%.ref) $(NORMALIZER)
22
	$(HIDE)TEST="$$(basename -s .v $<)" && \
Ralf Jung's avatar
Ralf Jung committed
23 24 25 26 27
	  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
28
	  echo "COQTEST$(if $(COQ_OLD), [no ref],$(if $(MAKE_REF), [make ref],)) $<$(if $(COQ_OLD),, (ref: $$REF))" && \
29
	  TMPFILE="$$(mktemp)" && \
30
	  $(TIMER) $(COQ_TEST) $(COQFLAGS) $(COQLIBS) -load-vernac-source $< > "$$TMPFILE" && \
31
	  sed -f $(NORMALIZER) -i "$$TMPFILE" && \
Ralf Jung's avatar
Ralf Jung committed
32 33
	  $(if $(COQ_OLD),true, \
	    $(if $(MAKE_REF),mv "$$TMPFILE" "$$REF",diff -u "$$REF" "$$TMPFILE") \
34
	  ) && \
35
	  rm -f "$$TMPFILE" && \
36
	  touch $@