Skip to content

Commit

Permalink
Fix GNATprove caching
Browse files Browse the repository at this point in the history
Ref. eng/recordflux/RecordFlux#1391
  • Loading branch information
treiher committed Aug 10, 2023
1 parent 0ea5515 commit 8f4a636
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
14 changes: 1 addition & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-include devutils/Makefile.common
include Makefile.common

.DEFAULT_GOAL := all

Expand All @@ -11,9 +12,7 @@ ADASAT_ORIGIN?= https://github.com/AdaCore
VERSION ?= $(shell python3 -c "import setuptools_scm; print(setuptools_scm.get_version())")
SDIST ?= dist/RecordFlux-$(VERSION).tar.gz

BUILD_DIR = build
GENERATED_DIR = generated
MAKEFILE_DIR := $(dir $(abspath Makefile))
BUILD_GENERATED_DIR := $(MAKEFILE_DIR)/$(BUILD_DIR)/$(GENERATED_DIR)
PYTHON_PACKAGES = bin doc/language_reference/conf.py doc/user_guide/conf.py examples/apps ide language rflx tests tools stubs setup.py
DEVUTILS_HEAD = 7f4319741b23b926aca093467e097005d4a1f642
Expand All @@ -24,14 +23,6 @@ ADASAT_HEAD = f948e2271aec51f9313fa41ff3c00230a483f9e8
SHELL = /bin/bash
PYTEST = python3 -m pytest -n$(TEST_PROCS) -vv --timeout=7200

# Use GNATprove's file-based caching by default and ensure the directory exists.
GNATPROVE_CACHE ?= file:$(MAKEFILE_DIR)/$(BUILD_DIR)/gnatprove_cache

ifneq (,$(findstring file:,$(GNATPROVE_CACHE)))
GNATPROVE_CACHE_DIR = $(subst file:,,$(GNATPROVE_CACHE))
endif

export GNATPROVE_CACHE := $(GNATPROVE_CACHE)
export PYTHONPATH := $(MAKEFILE_DIR)

# Switch to a specific revision of the git repository.
Expand Down Expand Up @@ -210,9 +201,6 @@ prove_apps: $(GNATPROVE_CACHE_DIR)
prove_property_tests: $(GNATPROVE_CACHE_DIR)
$(PYTEST) tests/property_verification

$(GNATPROVE_CACHE_DIR):
mkdir -p $(GNATPROVE_CACHE_DIR)

.PHONY: install_build_deps install install_devel upgrade_devel install_devel_edge install_git_hooks install_gnat printenv_gnat

install_build_deps:
Expand Down
15 changes: 15 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BUILD_DIR = build
MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
GNATPROVE = $(MAKEFILE_DIR)tools/gnatprove

# Use GNATprove's file-based caching by default and ensure the directory exists.
GNATPROVE_CACHE ?= file:$(MAKEFILE_DIR)$(BUILD_DIR)/gnatprove_cache

ifneq (,$(findstring file:,$(GNATPROVE_CACHE)))
GNATPROVE_CACHE_DIR = $(subst file:,,$(GNATPROVE_CACHE))
endif

export GNATPROVE_CACHE := $(GNATPROVE_CACHE)

$(GNATPROVE_CACHE_DIR):
mkdir -p $(GNATPROVE_CACHE_DIR)
4 changes: 2 additions & 2 deletions examples/apps/dhcp_client/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GNATPROVE = ../../../tools/gnatprove
include ../../../Makefile.common

specs = $(wildcard specs/*.rflx)
src = generated/rflx-dhcp_client.ads
Expand All @@ -12,7 +12,7 @@ test: $(bin)

build: $(bin)

prove: $(src)
prove: $(GNATPROVE_CACHE_DIR) $(src)
$(GNATPROVE) -Pdhcp_client

generate: $(src)
Expand Down
4 changes: 2 additions & 2 deletions examples/apps/ping/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GNATPROVE = ../../../tools/gnatprove
include ../../../Makefile.common

specs = $(wildcard specs/*.rflx)
src = generated/rflx.ads
Expand All @@ -16,7 +16,7 @@ test_spark: $(bin)

build: $(bin)

prove: $(src)
prove: $(GNATPROVE_CACHE_DIR) $(src)
$(GNATPROVE) -Pping

generate: $(src)
Expand Down
4 changes: 2 additions & 2 deletions tests/spark/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GNATPROVE = ../../tools/gnatprove
include ../../Makefile.common

project := test
ifdef TEST
Expand Down Expand Up @@ -28,7 +28,7 @@ test_optimized: $(test_files)
build_strict: $(test_files)
gprbuild -P$(project) -Xgnat=$(GNAT) -Xmode=strict

prove: $(proof_sessions) $(test_files)
prove: $(GNATPROVE_CACHE_DIR) $(proof_sessions) $(test_files)
$(GNATPROVE) -P$(project) -Xtest=$(TEST)

clean:
Expand Down

0 comments on commit 8f4a636

Please sign in to comment.