Makefile.coq.local 1.6 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 12 13 14

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

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

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

# a target, for convenience sake, to create the .ref file with the current output
ref: $(TESTFILES:.v=.ref)
.PHONY: ref

36
# coqdep doesn't emit dependencies for these so we just depend on everything
37
tests/%.ref: tests/%.v $(VFILES:.v=.vo)
38
	$(SHOW)COQTOP [ref] $<
39
	$(HIDE)TEST="$$(basename -s .v $<)" && \
40 41 42
	  $(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"