From c57242d40a5ec670d545313afb5a4735c4e016e4 Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Thu, 2 May 2024 16:16:13 +0200 Subject: [PATCH 1/3] Kompile test contracts in-advance --- scripts/performance-tests-kontrol.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/performance-tests-kontrol.sh b/scripts/performance-tests-kontrol.sh index 2814d108e5..9acc880240 100755 --- a/scripts/performance-tests-kontrol.sh +++ b/scripts/performance-tests-kontrol.sh @@ -93,16 +93,27 @@ master_shell() { GC_DONT_GC=1 nix develop . --extra-experimental-features 'nix-command flakes' --override-input kevm/k-framework/haskell-backend github:runtimeverification/haskell-backend/$MASTER_COMMIT --command bash -c "$1" } +# kompile Kontrol's K dependencies feature_shell "poetry install && poetry run kdist --verbose build evm-semantics.plugin evm-semantics.haskell kontrol.foundry --jobs 4" +# kompile the test contracts, to be reused in feature_shell and master_shell. Copy the result from pytest's temp directory +PYTEST_TEMP_DIR=$TEMPD/pytest-temp-dir +mkdir -p $PYTEST_TEMP_DIR +FOUNDRY_DIR=$TEMPD/foundry +mkdir -p $FOUNDRY_DIR +feature_shell "make test-integration TEST_ARGS='--basetemp=$PYTEST_TEMP_DIR -n0 --dist=no -k test_foundry_kompile'" +cp -r $PYTEST_TEMP_DIR/foundry/* $FOUNDRY_DIR + mkdir -p $SCRIPT_DIR/logs -feature_shell "make test-integration TEST_ARGS='--maxfail=0 --numprocesses=$PYTEST_PARALLEL -vv $BUG_REPORT' | tee $SCRIPT_DIR/logs/kontrol-$KONTROL_VERSION-$FEATURE_BRANCH_NAME.log" +feature_shell "make test-integration TEST_ARGS='--foundry-root $FOUNDRY_DIR --maxfail=0 --numprocesses=$PYTEST_PARALLEL -vv $BUG_REPORT' | tee $SCRIPT_DIR/logs/kontrol-$KONTROL_VERSION-$FEATURE_BRANCH_NAME.log" killall kore-rpc-booster || echo "no zombie processes found" if [ -z "$BUG_REPORT" ]; then if [ ! -e "$SCRIPT_DIR/logs/kontrol-$KONTROL_VERSION-master-$MASTER_COMMIT_SHORT.log" ]; then - master_shell "make test-integration TEST_ARGS='--maxfail=0 --numprocesses=$PYTEST_PARALLEL -vv' | tee $SCRIPT_DIR/logs/kontrol-$KONTROL_VERSION-master-$MASTER_COMMIT_SHORT.log" + # remove proofs so that they are not reused by the master shell call + rm -r $FOUNDRY_DIR/out/proofs + master_shell "make test-integration TEST_ARGS='--foundry-root $FOUNDRY_DIR --maxfail=0 --numprocesses=$PYTEST_PARALLEL -vv' | tee $SCRIPT_DIR/logs/kontrol-$KONTROL_VERSION-master-$MASTER_COMMIT_SHORT.log" killall kore-rpc-booster || echo "no zombie processes found" fi From ceee361cb5f835c31830c13cd5b9a567ae962343 Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Fri, 3 May 2024 16:06:10 +0200 Subject: [PATCH 2/3] Allow keeping TEMPD --- scripts/performance-tests-kontrol.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/performance-tests-kontrol.sh b/scripts/performance-tests-kontrol.sh index 9acc880240..3c0d1f5ab8 100755 --- a/scripts/performance-tests-kontrol.sh +++ b/scripts/performance-tests-kontrol.sh @@ -30,9 +30,16 @@ if [ ! -e "$TEMPD" ]; then exit 1 fi -# Make sure the temp directory gets removed and kore-rpc-booster gets killed on script exit. -trap "exit 1" HUP INT PIPE QUIT TERM -trap 'rm -rf "$TEMPD" && killall kore-rpc-booster || echo "no zombie processes found"' EXIT +clean_up () { + if [ -z "$KEEP_TEMPD" ]; then + rm -rf "$TEMPD" + fi + killall kore-rpc-booster || echo "no zombie processes found" +} + +# Make sure the temp directory gets removed (unless KEEP_TEMPD is set) and kore-rpc-booster gets killed on script exit. +trap "exit 1" HUP INT PIPE QUIT TERM +trap clean_up EXIT cd $TEMPD git clone --depth 1 --branch $KONTROL_VERSION https://github.com/runtimeverification/kontrol.git From 1e7e72a094126ba0caf0d037f0a65ed3a21d138b Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Tue, 7 May 2024 08:43:04 +0200 Subject: [PATCH 3/3] Add default value for KEEP_TEMPD --- scripts/performance-tests-kontrol.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/performance-tests-kontrol.sh b/scripts/performance-tests-kontrol.sh index 3c0d1f5ab8..dbd724e59a 100755 --- a/scripts/performance-tests-kontrol.sh +++ b/scripts/performance-tests-kontrol.sh @@ -23,6 +23,7 @@ fi # Create a temporary directory and store its name in a variable. TEMPD=$(mktemp -d) +KEEP_TEMPD=${KEEP_TEMPD:-''} # Exit if the temp directory wasn't created successfully. if [ ! -e "$TEMPD" ]; then