-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
77 lines (58 loc) · 2.62 KB
/
Makefile
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
66
67
68
69
70
71
72
73
74
75
76
#
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: BSD-2-Clause
#
default: AutoCorresTest
all: AutoCorres AutoCorresTest AutoCorresSEL4 AutoCorresDoc
report-regression:
@echo AutoCorres AutoCorresTest AutoCorresDoc AutoCorresSEL4
PARSE_TESTS_C := $(wildcard tests/parse-tests/*.c)
PARSE_TESTS_THY := $(patsubst %.c,%.thy,$(PARSE_TESTS_C))
PROOF_TESTS_C := $(wildcard tests/proof-tests/*.c)
PROOF_TESTS_THY := $(wildcard tests/proof-tests/*.thy)
EXAMPLES_C := $(wildcard tests/examples/*.c)
EXAMPLES_THY := $(wildcard tests/examples/*.thy)
ALL_TESTS_C := $(PARSE_TESTS_C) $(PROOF_TESTS_C) $(EXAMPLES_C)
ALL_TESTS_THY := $(PARSE_TESTS_THY) $(PROOF_TESTS_THY) $(EXAMPLES_THY)
# Generate an Isabelle "ROOT" file containing all of our test cases.
tests/ROOT: $(ALL_TESTS_C) $(ALL_TESTS_THY) ../../misc/scripts/gen_isabelle_root.py
python3 ../../misc/scripts/gen_isabelle_root.py -o $@ -b AutoCorres -s AutoCorresTest -d HOL-Number_Theory \
-i tests/parse-tests -i tests/proof-tests -i tests/examples --quick-and-dirty
# Generate a Isabelle "All.thy" file containing imports to all the test cases.
tests/All.thy: $(ALL_TESTS_C) $(ALL_TESTS_THY) ../../misc/scripts/gen_isabelle_root.py
python3 ../../misc/scripts/gen_isabelle_root.py -T -o $@ \
-i tests/parse-tests -i tests/proof-tests -i tests/examples
SPDX_TAG=SPDX-License-Identifier
# Generate a template ".thy" file from a ".c" file,
# but only for ".c" files in tests/parse-tests.
$(PARSE_TESTS_THY): %.thy: %.c
@echo "Generating '$@' from '$<'..."
@printf '(*\n * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)\n *\n' > $@
@printf ' * $(SPDX_TAG): BSD-2-Clause\n *)\n\n' >> $@
@printf '(* This file was generated by tools/autocorres/Makefile *)\n\n' >> $@
@printf 'theory %s\nimports "AutoCorres.AutoCorres"\nbegin\n\n' $(notdir $(basename $<)) >> $@
@printf 'external_file "%s"\n\n' $(notdir $<) >> $@
@printf 'install_C_file "%s"\n\n' $(notdir $<) >> $@
@printf 'autocorres "%s"\n\n' $(notdir $<) >> $@
@printf 'end\n' >> $@
# Test all the files in our "tests/" directory.
AutoCorresTest: clean-tests tests/ROOT
$(ISABELLE_TOOL) build -d ../.. -d tests -b -v AutoCorresTest
.PHONY: AutoCorresTest
# Parse the seL4 kernel
AutoCorresSEL4:
make -C ../../proof CBaseRefine
$(ISABELLE_TOOL) build -d ../.. -b -v AutoCorresSEL4
.PHONY: AutoCorresSEL4
# Build the documentation sub-sessions.
AutoCorresDoc:
$(ISABELLE_TOOL) build -d ../.. -D doc/quickstart
# Clean out files generated by the test suite.
clean-tests:
rm -f tests/parse-tests/*.thy
rm -f tests/ROOT
.PHONY: clean-tests
clean: clean-tests
HEAPS := AutoCorres
include ../../misc/isa-common.mk