-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is part of the new build, but self-contained enough to be merged before that. It unifies most makefiles in tests/ into a single mk/test.mk (mk is a new top-level directory for make infra). It also disconnects examples/ and tests/. The mutually recursive inclusions are hard to work with.
- Loading branch information
Showing
59 changed files
with
381 additions
and
522 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# This makefile is included from several other makefiles in the tree. | ||
|
||
MAKEFLAGS += --no-builtin-rules | ||
Q?=@ | ||
SIL?=--silent | ||
RUNLIM= | ||
ifneq ($(V),) | ||
Q= | ||
SIL= | ||
else | ||
MAKEFLAGS += -s | ||
endif | ||
|
||
define NO_RUNLIM_ERR | ||
runlim not found: | ||
To use RESOURCEMONITOR=1, the `runlim` tool must be installed and in your $$PATH. | ||
It must also be a recent version supporting the `-p` option. | ||
You can get it from: [https://github.com/arminbiere/runlim] | ||
endef | ||
|
||
define msg = | ||
@printf " %-14s %s\n" $(1) $(2) | ||
endef | ||
define bold_msg = | ||
@#-tput bold 2>/dev/null | ||
@printf -- " %-15s" $(1) | ||
@#-tput sgr0 2>/dev/null | ||
@printf " %s\n" $(2) | ||
endef | ||
|
||
# Passing RESOURCEMONITOR=1 will create .runlim files through the source tree with | ||
# information about the time and space taken by each F* invocation. | ||
ifneq ($(RESOURCEMONITOR),) | ||
ifeq ($(shell which runlim),) | ||
_ := $(error $(NO_RUNLIM_ERR))) | ||
endif | ||
ifneq ($(MONID),) | ||
MONPREFIX=$(MONID). | ||
endif | ||
RUNLIM=runlim -p -o $@.$(MONPREFIX)runlim | ||
endif | ||
|
||
# Ensure that any failing rule will not create its target file. | ||
# In other words, make `make` less insane. | ||
.DELETE_ON_ERROR: | ||
|
||
.DEFAULT_GOAL:=__undef | ||
.PHONY: __undef | ||
__undef: | ||
$(error "This makefile does not have a default goal") | ||
|
||
# Check that a variable is defined. If not, abort with an (optional) error message. | ||
need = \ | ||
$(if $(value $(strip $1)),, \ | ||
$(error Need a value for $(strip $1)$(if $2, ("$(strip $2)")))) | ||
|
||
# Check that a variable is defined and pointing to an executable. | ||
# Is there no negation in make...? | ||
# Wew! this was interesting to write. Especially the override part. | ||
need_exe = \ | ||
$(if $(value $(strip $1)), \ | ||
$(if $(wildcard $(value $(strip $1))), \ | ||
$(if $(shell test -x $(value $(strip $1)) && echo 1), \ | ||
$(eval override $(strip $1):=$(abspath $(value $(strip $1)))), \ | ||
$(error $(strip $1) ("$(value $(strip $1))") is not executable)), \ | ||
$(error $(strip $1) ("$(value $(strip $1))") does not exist (cwd = $(CURDIR)))), \ | ||
$(error Need an executable for $(strip $1)$(if $2, ("$(strip $2)")))) \ | ||
|
||
need_file = \ | ||
$(if $(value $(strip $1)), \ | ||
$(if $(wildcard $(value $(strip $1))), \ | ||
$(if $(shell test -f $(value $(strip $1)) && echo 1), \ | ||
$(eval override $(strip $1):=$(abspath $(value $(strip $1)))), \ | ||
$(error $(strip $1) ("$(value $(strip $1))") is not executable)), \ | ||
$(error $(strip $1) ("$(value $(strip $1))") does not exist (cwd = $(CURDIR)))), \ | ||
$(error Need a file path for $(strip $1)$(if $2, ("$(strip $2)")))) \ | ||
|
||
need_dir = \ | ||
$(if $(value $(strip $1)), \ | ||
$(if $(wildcard $(value $(strip $1))), \ | ||
$(if $(shell test -d $(value $(strip $1)) && echo 1), \ | ||
$(eval override $(strip $1):=$(abspath $(value $(strip $1)))), \ | ||
$(error $(strip $1) ("$(value $(strip $1))") is not executable)), \ | ||
$(error $(strip $1) ("$(value $(strip $1))") is not a directory (cwd = $(CURDIR)))), \ | ||
$(error Need an *existing* directory path for $(strip $1)$(if $2, ("$(strip $2)")))) \ | ||
|
||
need_dir_mk = \ | ||
$(if $(value $(strip $1)), \ | ||
$(if $(shell mkdir -p $(value $(strip $1)) && echo 1), \ | ||
$(eval override $(strip $1):=$(abspath $(value $(strip $1)))), \ | ||
$(error $(strip $1) ("$(value $(strip $1))") is not a directory (mkdir failed, cwd = $(CURDIR)))), \ | ||
$(error Need a directory path for $(strip $1)$(if $2, ("$(strip $2)")))) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Include this makefile for unit tests. It mostly has all you need. | ||
# This is NOT meant for external consumption. Do not point to this. | ||
|
||
ifeq ($(FSTAR_ROOT),) | ||
$(error FSTAR_ROOT is not set. Please set it to the root of your F* repository) | ||
endif | ||
include $(FSTAR_ROOT)/mk/common.mk | ||
.DEFAULT_GOAL := all | ||
|
||
# Set a default FSTAR_EXE for most clients. | ||
FSTAR_EXE ?= $(FSTAR_ROOT)/bin/fstar.exe | ||
|
||
OCAMLOPT := $(FSTAR_EXE) --ocamlenv ocamlfind opt | ||
|
||
HINTS_ENABLED?=--use_hints | ||
|
||
# This warning is really useless. | ||
OTHERFLAGS += --warn_error -321 | ||
OTHERFLAGS += --ext context_pruning | ||
|
||
# Set ADMIT=1 to admit queries | ||
ADMIT ?= | ||
MAYBE_ADMIT = $(if $(ADMIT),--admit_smt_queries true) | ||
|
||
OUTPUT_DIR ?= _output | ||
CACHE_DIR ?= _cache | ||
|
||
FSTAR = $(FSTAR_EXE) $(SIL) \ | ||
--cache_checked_modules \ | ||
--odir $(OUTPUT_DIR) \ | ||
--cache_dir $(CACHE_DIR) \ | ||
--already_cached Prims,FStar \ | ||
$(OTHERFLAGS) $(MAYBE_ADMIT) $(HINTS_ENABLED) | ||
|
||
ifeq ($(NODEPEND),) | ||
FSTAR_FILES ?= $(wildcard *.fst) $(wildcard *.fsti) | ||
$(call need, FSTAR_FILES, "List of F* files to verify. It defaults to all fst/fsti in the directory (none were found)") | ||
|
||
.depend: $(FSTAR_FILES) | ||
$(call msg, "DEPEND", $(CURDIR)) | ||
$(FSTAR) --dep full $(FSTAR_FILES) --output_deps_to $@ | ||
depend: .depend | ||
include .depend | ||
endif | ||
|
||
%.fst.checked: | ||
$(call msg, "CHECK", $(basename $(notdir $@))) | ||
$(FSTAR) $< | ||
touch -c $@ | ||
|
||
%.fsti.checked: | ||
$(call msg, "CHECK", $(basename $(notdir $@))) | ||
$(FSTAR) $< | ||
touch -c $@ | ||
|
||
%.fst.output: %.fst | ||
$(call msg, "OUTPUT", $(basename $(notdir $@))) | ||
$(FSTAR) --message_format human -f --print_expected_failures $< >$@ 2>&1 | ||
|
||
%.fsti.output: %.fsti | ||
$(call msg, "OUTPUT", $(basename $(notdir $@))) | ||
$(FSTAR) --message_format human -f --print_expected_failures $< >$@ 2>&1 | ||
|
||
%.fst.json_output: %.fst | ||
$(call msg, "JSONOUT", $(basename $(notdir $@))) | ||
$(FSTAR) --message_format json -f --print_expected_failures $< >$@ 2>&1 | ||
|
||
%.fsti.json_output: %.fsti | ||
$(call msg, "JSONOUT", $(basename $(notdir $@))) | ||
$(FSTAR) --message_format json -f --print_expected_failures $< >$@ 2>&1 | ||
|
||
$(OUTPUT_DIR)/%.ml: | ||
$(call msg, "EXTRACT", $(basename $(notdir $@))) | ||
$(FSTAR) $(subst .checked,,$(notdir $<)) --codegen OCaml --extract_module $(subst .fst.checked,,$(notdir $<)) | ||
|
||
verify-all: $(ALL_CHECKED_FILES) | ||
|
||
clean: | ||
rm -rf $(OUTPUT_DIR) $(CACHE_DIR) .depend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
_cache | ||
_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"fstar_exe": "../bin/fstar.exe", | ||
"options": [ | ||
"--ext", "context_pruning" | ||
], | ||
"include_dirs": [ | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FSTAR_EXE ?= ../../bin/fstar.exe | ||
FSTAR_ROOT ?= ../.. | ||
include $(FSTAR_ROOT)/mk/common.mk | ||
include $(FSTAR_ROOT)/ulib/gmake/fstar.mk | ||
|
||
# we ignore the return result in benchmark runs because we can have micro-benchmarks which | ||
# produce error asserts when executed with '--admit_smt_queries true' | ||
%.uver: %.fst | ||
$(Q)$(BENCHMARK_PRE) $(FSTAR) $^ | ||
|
||
%.fail-uver: %.fst | ||
(! $(FSTAR) $^ >/dev/null 2>&1) || (echo "NEGATIVE TEST FAILED ($@)!" ; false) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FSTAR_ROOT ?= ../.. | ||
include $(FSTAR_ROOT)/mk/test.mk | ||
all: verify-all |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,3 @@ | ||
FSTAR_HOME=../.. | ||
|
||
FSTAR_FILES = $(wildcard *.fst) | ||
|
||
FSTAR_ROOT ?= ../.. | ||
include $(FSTAR_ROOT)/mk/test.mk | ||
all: verify-all | ||
|
||
include $(FSTAR_HOME)/examples/Makefile.common | ||
|
||
verify-all: $(CACHE_DIR) $(addsuffix .checked, $(addprefix $(CACHE_DIR)/, $(FSTAR_FILES))) | ||
|
||
clean: | ||
rm -f .depend | ||
rm -rf _cache | ||
rm -rf _output |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.