Commit dbf8321a authored by Ralf Jung's avatar Ralf Jung
Browse files

change the way we generate test reference files

parent 2f1ae293
......@@ -29,7 +29,7 @@ variables:
<<: *template
BUILD_TARGET: "ref" # don't check test output
MAKE_REF: "1" # don't check test output
OPAM_PINS: "coq version dev"
......@@ -19,24 +19,14 @@ tests/.coqdeps.d: $(TESTFILES)
$(HIDE)$(COQDEP) -dyndep var $(COQMF_COQLIBS_NOML) $^ $(redir_if_ok)
-include tests/.coqdeps.d
$(TESTFILES:.v=.vo): %.vo: %.v
$(TESTFILES:.v=.vo): %.vo: %.v $(if $(MAKE_REF),,%.ref)
$(SHOW)COQTOP [test] $<
$(HIDE)TEST="$$(basename -s .v $<)" && \
TMPFILE="$$(mktemp)" && \
$(TIMER) $(COQ_TEST) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) -load-vernac-source $< $(TIMING_EXTRA) > "$$TMPFILE" && \
($(REF_FILTER) < "$$TMPFILE" > "$$TMPFILE.filtered" || true) && \
(diff -u "tests/$$TEST.ref" "$$TMPFILE.filtered" || rm -f "tests/$$TEST.vo" "$$TMPFILE" "$$TMPFILE.filtered") && \
rm "$$TMPFILE" "$$TMPFILE.filtered" && \
$(if $(MAKE_REF), \
mv "$$TMPFILE.filtered" "tests/$$TEST.ref", \
diff -u "tests/$$TEST.ref" "$$TMPFILE.filtered") && \
rm -f "$$TMPFILE" "$$TMPFILE.filtered" && \
touch $@
# a target, for convenience sake, to create the .ref file with the current output
ref: $(TESTFILES:.v=.ref)
.PHONY: ref
# coqdep doesn't emit dependencies for these so we just depend on everything
tests/%.ref: tests/%.v $(VFILES:.v=.vo)
$(SHOW)COQTOP [ref] $<
$(HIDE)TEST="$$(basename -s .v $<)" && \
$(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"
......@@ -118,6 +118,6 @@ The files in `tests/` are test cases. Each of the `.v` files comes with a
matching `.ref` file containing the expected output of `coqc`. Adding `Show.`
in selected places in the proofs makes `coqc` print the current goal state.
This is used to make sure the proof mode prints goals and reduces terms the way
we expect it to. You can run `make ref` to re-generate all the `.ref` files;
we expect it to. You can run `MAKE_REF=1 make` to re-generate all the `.ref` files;
this is useful after adding or removing `Show.` from a test. If you do this,
make sure to check the diff for any unexpected changes in the output!
Subproject commit 16c8b6107119db3448b6828d3d2757888f2b2376
Subproject commit 8ec855ae44ec77fa7ce4e13101c6a08441d3abba
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment