-
Notifications
You must be signed in to change notification settings - Fork 4
/
ktest-hacked.mak
65 lines (50 loc) · 1.92 KB
/
ktest-hacked.mak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# CHANGE FROM ORIGINAL: corrected, path to krun, same depth as path to the original ktest.mak
MAKEFILE_PATH := $(dir $(abspath $(shell which krun)))
# path to the kompile binary of this distribuition
KOMPILE=$(abspath $(MAKEFILE_PATH)/../bin/kompile)
# ditto for krun
KRUN=$(abspath $(MAKEFILE_PATH)/../bin/krun)
# and kdep
KDEP=$(abspath $(MAKEFILE_PATH)/../bin/kdep)
# and kprove
KPROVE=$(abspath $(MAKEFILE_PATH)/../bin/kprove)
# path relative to current definition of test programs
TESTDIR?=tests
# path to put -kompiled directory in
DEFDIR?=.
# path relative to current definition of output/input files
RESULTDIR?=$(TESTDIR)
# all tests in test directory with matching file extension
# CHANGE FROM ORIGINAL: minor extension here to allow rewriting the var in Makefile
TESTS?=$(wildcard $(TESTDIR)/*.$(EXT))
PROOF_TESTS=$(wildcard $(TESTDIR)/*-spec.k)
CHECK=| diff -
.PHONY: kompile krun all clean update-results proofs
# run all tests
all: kompile krun proofs
# run only kompile
kompile: $(DEFDIR)/$(DEF)-kompiled/timestamp
$(DEFDIR)/%-kompiled/timestamp: %.k
$(KOMPILE) $(KOMPILE_FLAGS) $(DEBUG) $< -d $(DEFDIR)
krun: $(TESTS)
proofs: $(PROOF_TESTS)
# run all tests and regenerate output files
update-results: krun proofs
update-results: CHECK=>
# run a single test. older versions of make run pattern rules in order, so
# if some programs should be run with different options their rule should be
# specified in the makefile prior to including ktest.mak.
%.$(EXT): kompile
ifeq ($(TESTDIR),$(RESULTDIR))
cat $@.in 2>/dev/null | $(KRUN) $@ $(KRUN_FLAGS) $(DEBUG) -d $(DEFDIR) $(CHECK) $@.out
else
cat $(RESULTDIR)/$(notdir $@).in 2>/dev/null | $(KRUN) $@ $(KRUN_FLAGS) $(DEBUG) -d $(DEFDIR) $(CHECK) $(RESULTDIR)/$(notdir $@).out
endif
%-spec.k: kompile
$(KPROVE) -d $(DEFDIR) --z3-executable $@ $(CHECK) $@.out
clean:
rm -rf $(DEFDIR)/$(DEF)-kompiled
.depend:
@$(KDEP) $(DEF).k > .depend-tmp
@mv .depend-tmp .depend
-include .depend