Commit 2eab06b4 authored by F-WRunTime's avatar F-WRunTime

Saving testable scripts and pnpm package.json additions

parent 5ac60149
...@@ -7,6 +7,9 @@ parameters: ...@@ -7,6 +7,9 @@ parameters:
base_image: base_image:
type: string type: string
default: ubuntu-2204:2022.07.1 default: ubuntu-2204:2022.07.1
kontrol_image:
type: string
default: runtimeverificationinc/kontrol:ubuntu-jammy-0.1.74
orbs: orbs:
go: circleci/go@1.8.0 go: circleci/go@1.8.0
...@@ -1343,20 +1346,27 @@ jobs: ...@@ -1343,20 +1346,27 @@ jobs:
kontrol-tests: kontrol-tests:
docker: docker:
- image: runtimeverificationinc/kontrol:ubuntu-jammy-0.1.74 - image: << pipeline.parameters.kontrol_image >>
resource_class: xlarge resource_class: xlarge
steps: steps:
- checkout - checkout
- check-changed: - check-changed:
patterns: contracts-bedrock/test/kontrol,contracts-bedrock/src/L1/OptimismPortal\.sol patterns: contracts-bedrock/test/kontrol,contracts-bedrock/src/L1/OptimismPortal\.sol
- attach_workspace: { at: "/home/user" }
- run:
name: Install pnpm to Kontrol image
command: |
curl -fsSL https://get.pnpm.io/install.sh | sh -
- run: - run:
name: Run Kontrol Tests name: Run Kontrol Tests
command: | command: |
./packages/contracts-bedrock/scripts/kontrol.sh pnpm test:kontrol
working_directory: /home/users/packages/contracts-bedrock
- run: - run:
name: Create Results Tar name: Create Results Tar
command: | command: |
tar -czvf results.tar.gz packages/contracts-bedrock/kout tar -czvf results.tar.gz test/kontrol/kontrol/kout/proofs
working_directory: /home/user/packages/contracts-bedrock
- store_artifacts: - store_artifacts:
path: results.tar.gz path: results.tar.gz
destination: results destination: results
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"build:go-ffi": "(cd scripts/go-ffi && go build)", "build:go-ffi": "(cd scripts/go-ffi && go build)",
"autogen:invariant-docs": "npx tsx scripts/invariant-doc-gen.ts", "autogen:invariant-docs": "npx tsx scripts/invariant-doc-gen.ts",
"test": "pnpm build:go-ffi && forge test", "test": "pnpm build:go-ffi && forge test",
"test:kontrol": "./test/kontrol/kontrol/run-kontrol.sh",
"genesis": "./scripts/generate-l2-genesis.sh", "genesis": "./scripts/generate-l2-genesis.sh",
"coverage": "pnpm build:go-ffi && forge coverage", "coverage": "pnpm build:go-ffi && forge coverage",
"coverage:lcov": "pnpm build:go-ffi && forge coverage --report lcov", "coverage:lcov": "pnpm build:go-ffi && forge coverage --report lcov",
......
#!/usr/bin/env bash #!/usr/bin/env bash
set -exuo pipefail set -exuo pipefail
blank_line() { echo '' >&2 ; }
notif() { echo "== $0: $@" >&2 ; }
quit() { notif "[QUITTING]: $@" ; exit 0 ; }
fatal() { notif "[FATAL]: $@" ; exit 1 ; }
debug() { if ${do_debug}; then notif "[DEBUG]: $@"; fi ; }
safe_executor() { if ${do_debug}; then debug $@ ; else "$@" ; fi ; }
# Set Script Directory Variables
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Set Directory for run-kontrol.sh
KONTROL_DIR=$CURENT_DIR=$SCRIPT_DIR/../../test/kontrol/kontrol
CONTRACTS_DIR=$SCRIPT_DIR/..
notif "Run Directory Set to $RUN_DIR"
# Setup Kontrol # Setup Kontrol
cd packages/contracts-bedrock && ./test/kontrol/kontrol/run-kontrol.sh
...@@ -2,18 +2,47 @@ ...@@ -2,18 +2,47 @@
set -euxo pipefail set -euxo pipefail
#####################
# Support Functions #
#####################
blank_line() { echo '' >&2 ; }
notif() { echo "== $0: $@" >&2 ; }
###########
# Globals #
###########
export FOUNDRY_PROFILE=kontrol export FOUNDRY_PROFILE=kontrol
# Create a log file to store standard out and standard error # Set Script Directory Variables <root>/packages/contracts-bedrock/test/kontrol/kontrol
LOG_DIRECTORY="test/kontrol/kontrol/logs" SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
notif "Script Home: $SCRIPT_HOME"
blank_line
# Set Run Directory <root>/packages/contracts-bedrock
RUN_DIR="$( cd "$( dirname "$SCRIPT_HOME/../../.." )" >/dev/null 2>&1 && pwd )"
notif "Run Directory: $RUN_DIR"
blank_line
# Set Log Directory <root>/packages/contracts-bedrock/test/kontrol/kontrol/logs
LOG_DIRECTORY=$SCRIPT_HOME/logs
notif "Log Directory: $LOG_DIRECTORY"
blank_line
if [ ! -d $LOG_DIRECTORY ] ; then if [ ! -d $LOG_DIRECTORY ] ; then
mkdir $LOG_DIRECTORY mkdir $LOG_DIRECTORY
fi fi
LOG_FILE="run-kontrol-$(date +'%Y-%m-%d-%H-%M-%S').log" LOG_FILE="run-kontrol-$(date +'%Y-%m-%d-%H-%M-%S').log"
notif "Logging to $LOG_DIRECTORY/$LOG_FILE"
blank_line
exec > >(tee -i $LOG_DIRECTORY/$LOG_FILE) exec > >(tee -i $LOG_DIRECTORY/$LOG_FILE)
exec 2>&1 exec 2>&1
#############
# Functions #
#############
kontrol_build() { kontrol_build() {
notif "Kontrol Build"
kontrol build \ kontrol build \
--verbose \ --verbose \
--require ${lemmas} \ --require ${lemmas} \
...@@ -22,6 +51,7 @@ kontrol_build() { ...@@ -22,6 +51,7 @@ kontrol_build() {
} }
kontrol_prove() { kontrol_prove() {
notif "Kontrol Prove"
kontrol prove \ kontrol prove \
--max-depth ${max_depth} \ --max-depth ${max_depth} \
--max-iterations ${max_iterations} \ --max-iterations ${max_iterations} \
...@@ -36,51 +66,54 @@ kontrol_prove() { ...@@ -36,51 +66,54 @@ kontrol_prove() {
${use_booster} ${use_booster}
} }
### #########################
# kontrol build options # kontrol build options #
### #########################
# NOTE: This script has a recurring pattern of setting and unsetting variables, such as `rekompile`. Such a pattern is intended for easy use while locally developing and executing the proofs via this script. Comment/uncomment the empty assignment to activate/deactivate the corresponding flag # NOTE: This script has a recurring pattern of setting and unsetting variables, such as `rekompile`. Such a pattern is intended for easy use while locally developing and executing the proofs via this script. Comment/uncomment the empty assignment to activate/deactivate the corresponding flag
# NOTE: This script should be executed from the `contracts-bedrock` directory
lemmas=test/kontrol/kontrol/pausability-lemmas.k lemmas=test/kontrol/kontrol/pausability-lemmas.k
base_module=PAUSABILITY-LEMMAS base_module=PAUSABILITY-LEMMAS
module=CounterTest:${base_module} module=CounterTest:${base_module}
rekompile=--rekompile rekompile=--rekompile
rekompile= rekompile=
### #########################
# kontrol prove options # kontrol prove options #
### #########################
max_depth=10000 max_depth=10000
max_iterations=10000 max_iterations=10000
smt_timeout=100000 smt_timeout=100000
bmc_depth=10 bmc_depth=10
workers=2 workers=2
reinit=--reinit reinit=--reinit
reinit= reinit=
break_on_calls=--no-break-on-calls break_on_calls=--no-break-on-calls
# break_on_calls= # break_on_calls=
auto_abstract=--auto-abstract-gas auto_abstract=--auto-abstract-gas
# auto_abstract= # auto_abstract=
bug_report=--bug-report bug_report=--bug-report
bug_report= bug_report=
use_booster=--use-booster use_booster=--use-booster
# use_booster= # use_booster=
# List of tests to symbolically execute #########################################
# List of tests to symbolically execute #
#########################################
tests="" tests=""
tests+="--match-test CounterTest.test_SetNumber " tests+="--match-test CounterTest.test_SetNumber "
#############
# RUN TESTS #
#############
pushd $RUN_DIR
notif "Running Kontrol Build"
blank_line
kontrol_build kontrol_build
notif "Running Kontrol Prove"
blank_line
kontrol_prove kontrol_prove
blank_line
notif "DONE"
blank_line
popd 2>&1 > /dev/null
\ No newline at end of file
Markdown is supported
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