Skip to content

Commit 8bdd491

Browse files
committed
Enable pre-kompilation of K definitions and specs
1 parent a0ca443 commit 8bdd491

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

scripts/performance-tests-kevm.sh

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,30 @@ if [[ $FEATURE_BRANCH_NAME == "master" ]]; then
2222
fi
2323

2424
# Create a temporary directory and store its name in a variable.
25-
TEMPD=$(mktemp -d)
25+
FRESH_TEMPD=0
26+
TEMPD=${TEMPD:-''}
27+
if [ -z "$TEMPD" ]; then
28+
FRESH_TEMPD=1
29+
TEMPD=$(mktemp -d)
30+
fi
31+
KEEP_TEMPD=${KEEP_TEMPD:-''}
2632

2733
# Exit if the temp directory wasn't created successfully.
2834
if [ ! -e "$TEMPD" ]; then
2935
>&2 echo "Failed to create temp directory"
3036
exit 1
3137
fi
3238

33-
# Make sure the temp directory gets removed and kore-rpc-booster gets killed on script exit.
34-
trap "exit 1" HUP INT PIPE QUIT TERM
35-
trap 'rm -rf "$TEMPD" && killall kore-rpc-booster || echo "No zombie processes found"' EXIT
39+
clean_up () {
40+
if [ -z "$KEEP_TEMPD" ]; then
41+
rm -rf "$TEMPD"
42+
fi
43+
killall kore-rpc-booster || echo "no zombie processes found"
44+
}
45+
46+
# Make sure the temp directory gets removed (unless KEEP_TEMPD is set) and kore-rpc-booster gets killed on script exit.
47+
trap "exit 1" HUP INT PIPE QUIT TERM
48+
trap clean_up EXIT
3649

3750
feature_shell() {
3851
GC_DONT_GC=1 nix develop . --extra-experimental-features 'nix-command flakes' --override-input k-framework/haskell-backend $SCRIPT_DIR/../ --command bash -c "$1"
@@ -43,7 +56,9 @@ master_shell() {
4356
}
4457

4558
cd $TEMPD
46-
git clone --depth 1 --branch $KEVM_VERSION https://github.com/runtimeverification/evm-semantics.git
59+
if [[ $FRESH_TEMPD -gt 0 ]]; then
60+
git clone --depth 1 --branch $KEVM_VERSION https://github.com/runtimeverification/evm-semantics.git
61+
fi
4762
cd evm-semantics
4863

4964
if [[ $KEVM_VERSION == "master" ]]; then
@@ -52,7 +67,9 @@ else
5267
KEVM_VERSION="${KEVM_VERSION//\//-}"
5368
fi
5469

55-
git submodule update --init --recursive --depth 1 kevm-pyk/src/kevm_pyk/kproj/plugin
70+
if [[ $FRESH_TEMPD -gt 0 ]]; then
71+
git submodule update --init --recursive --depth 1 kevm-pyk/src/kevm_pyk/kproj/plugin
72+
fi
5673

5774
BUG_REPORT=''
5875
POSITIONAL_ARGS=()
@@ -77,18 +94,25 @@ done
7794

7895
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
7996

80-
feature_shell "make poetry && poetry run -C kevm-pyk -- kdist --verbose build evm-semantics.plugin evm-semantics.haskell --jobs 4"
97+
if [[ $FRESH_TEMPD -gt 0 ]]; then
98+
# kompile evm-semantics
99+
feature_shell "make poetry && poetry run -C kevm-pyk -- kdist --verbose build evm-semantics.plugin evm-semantics.haskell --jobs 4"
100+
fi
81101

102+
# kompile all verification K definitions and specs
103+
PREKOMPILED_DIR=$TEMPD/prekompiled
104+
mkdir -p $PREKOMPILED_DIR
105+
feature_shell "cd kevm-pyk && poetry run pytest src/tests/integration/test_prove.py::test_kompile_targets -vv --maxfail=0 --kompiled-targets-dir $PREKOMPILED_DIR"
82106

83107
mkdir -p $SCRIPT_DIR/logs
84108

85-
feature_shell "make test-prove-pyk PYTEST_PARALLEL=$PYTEST_PARALLEL PYTEST_ARGS='--maxfail=0 --timeout 7200 -vv --use-booster $BUG_REPORT' | tee $SCRIPT_DIR/logs/kevm-$KEVM_VERSION-$FEATURE_BRANCH_NAME.log"
109+
feature_shell "make test-prove-pyk PYTEST_PARALLEL=$PYTEST_PARALLEL PYTEST_ARGS='--maxfail=0 --timeout 7200 -vv --use-booster $BUG_REPORT --kompiled-targets-dir $PREKOMPILED_DIR' | tee $SCRIPT_DIR/logs/kevm-$KEVM_VERSION-$FEATURE_BRANCH_NAME.log"
86110
killall kore-rpc-booster || echo "No zombie processes found"
87111

88112

89113
if [ -z "$BUG_REPORT" ]; then
90114
if [ ! -e "$SCRIPT_DIR/logs/kevm-$KEVM_VERSION-master-$MASTER_COMMIT_SHORT.log" ]; then
91-
master_shell "make test-prove-pyk PYTEST_PARALLEL=$PYTEST_PARALLEL PYTEST_ARGS='--maxfail=0 --timeout 7200 -vv --use-booster' | tee $SCRIPT_DIR/logs/kevm-$KEVM_VERSION-master-$MASTER_COMMIT_SHORT.log"
115+
master_shell "make test-prove-pyk PYTEST_PARALLEL=$PYTEST_PARALLEL PYTEST_ARGS='--maxfail=0 --timeout 7200 -vv --use-booster --kompiled-targets-dir $PREKOMPILED_DIR' | tee $SCRIPT_DIR/logs/kevm-$KEVM_VERSION-master-$MASTER_COMMIT_SHORT.log"
92116
killall kore-rpc-booster || echo "No zombie processes found"
93117
fi
94118

0 commit comments

Comments
 (0)