Makefile.coq.local 1.13 KB
Newer Older
Ralf Jung's avatar
Ralf Jung committed
1 2 3 4 5 6 7 8 9 10
# run tests with main build
real-all: test

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

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

COQ_TEST=$(COQTOP) $(COQDEBUG) -batch -test-mode
Ralf Jung's avatar
Ralf Jung committed
11
COQ_OLD=$(shell echo "$(COQ_VERSION)" | egrep "^8\.7\b" -q && echo 1)
Ralf Jung's avatar
Ralf Jung committed
12
COQ_MINOR_VERSION=$(shell echo "$(COQ_VERSION)" | egrep '^[0-9]+\.[0-9]+\b' -o)
Ralf Jung's avatar
Ralf Jung committed
13 14 15 16 17 18 19 20

tests/.coqdeps.d: $(TESTFILES)
	$(SHOW)'COQDEP TESTFILES'
	$(HIDE)$(COQDEP) -dyndep var $(COQMF_COQLIBS_NOML) $^ $(redir_if_ok)
-include tests/.coqdeps.d

$(TESTFILES:.v=.vo): %.vo: %.v $(if $(MAKE_REF),,%.ref)
	$(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 $(if $(MAKE_REF),"COQTEST [make ref] `basename "$$REF"`","COQTEST$(if $(COQ_OLD), [ignored],) `basename "$$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
	  $(if $(MAKE_REF), \
30 31
	    mv "$$TMPFILE" "$$REF", \
	    $(if $(COQ_OLD),true,diff -u "$$REF" "$$TMPFILE") \
Ralf Jung's avatar
Ralf Jung committed
32
	  ) && \
33
	  rm -f "$$TMPFILE" && \
Ralf Jung's avatar
Ralf Jung committed
34
	  touch $@