diff --git a/scripts/booster-analysis.sh b/scripts/booster-analysis.sh index 5716075c..fb4c5509 100755 --- a/scripts/booster-analysis.sh +++ b/scripts/booster-analysis.sh @@ -29,7 +29,7 @@ export LOG_DIR=${LOG_DIR:-"$BUG_REPORT_DIR-logs"} mkdir -p $LOG_DIR K_VERSION=$(cat $SCRIPT_DIR/../deps/k_release) -export PATH="$(nix build github:runtimeverification/k/v$K_VERSION#k.openssl.procps --no-link --print-build-logs --json | jq -r '.[].outputs | to_entries[].value')/bin:$PATH" +export PATH="$(nix build github:runtimeverification/k/v$K_VERSION#k.openssl.procps.secp256k1 --no-link --print-build-logs --json | jq -r '.[].outputs | to_entries[].value')/bin:$PATH" PLUGIN_VERSION=$(cat $SCRIPT_DIR/../deps/blockchain-k-plugin_release) export PLUGIN_DIR=$(nix build github:runtimeverification/blockchain-k-plugin/$PLUGIN_VERSION --no-link --json | jq -r '.[].outputs | to_entries[].value') diff --git a/scripts/performance-tests-mx.sh b/scripts/performance-tests-mx.sh new file mode 100755 index 00000000..a4c9f9d5 --- /dev/null +++ b/scripts/performance-tests-mx.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +set -euxo pipefail + +# Disable the Python keyring, otherwise poetry sometimes asks for password. See +# https://github.com/pypa/pip/issues/7883 +export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring + +MX_VERSION=${MX_VERSION:-'master'} + +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" + +MASTER_COMMIT="$(git rev-parse origin/main)" +MASTER_COMMIT_SHORT="$(git rev-parse --short origin/main)" + +FEATURE_BRANCH_NAME=${FEATURE_BRANCH_NAME:-"$(git rev-parse --abbrev-ref HEAD)"} +FEATURE_BRANCH_NAME="${FEATURE_BRANCH_NAME//\//-}" + +PYTEST_PARALLEL=${PYTEST_PARALLEL:-3} + +if [[ $FEATURE_BRANCH_NAME == "master" ]]; then + FEATURE_BRANCH_NAME="feature" +fi + +# Create a temporary directory and store its name in a variable. +TEMPD=$(mktemp -d) + +# Exit if the temp directory wasn't created successfully. +if [ ! -e "$TEMPD" ]; then + >&2 echo "Failed to create temp directory" + 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 + +feature_shell() { + GC_DONT_GC=1 nix develop . --extra-experimental-features 'nix-command flakes' --override-input k-framework/booster-backend $SCRIPT_DIR/../ --command bash -c "$1" +} + +master_shell() { + GC_DONT_GC=1 nix develop . --extra-experimental-features 'nix-command flakes' --override-input k-framework/booster-backend github:runtimeverification/hs-backend-booster/$MASTER_COMMIT --command bash -c "$1" +} + +cd $TEMPD +git clone --depth 1 --branch $MX_VERSION https://github.com/runtimeverification/mx-backend.git +cd mx-backend + +if [[ $MX_VERSION == "master" ]]; then + MX_VERSION=$(git name-rev --tags --name-only $(git rev-parse HEAD)) +else + MX_VERSION="${MX_VERSION//\//-}" +fi + +git submodule update --init --recursive --depth 1 kmxwasm/k-src/mx-semantics/ + +BUG_REPORT='' +POSITIONAL_ARGS=() + +while [[ $# -gt 0 ]]; do + case $1 in + --bug-report) + mkdir -p $SCRIPT_DIR/bug-reports/mx-$MX_VERSION-$FEATURE_BRANCH_NAME + BUG_REPORT="--bug-report --bug-report-dir $SCRIPT_DIR/bug-reports/mx-$MX_VERSION-$FEATURE_BRANCH_NAME" + shift # past argument + ;; + -*|--*) + echo "Unknown option $1" + exit 1 + ;; + *) + POSITIONAL_ARGS+=("$1") # save positional arg + shift # past argument + ;; + esac +done + +set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters + + +feature_shell "poetry -C kmxwasm install && make -C kmxwasm kbuild-haskell" + + +mkdir -p $SCRIPT_DIR/logs + +feature_shell "make -C kmxwasm test-booster TEST_ARGS='$BUG_REPORT' && make -C kmxwasm test-integration TEST_ARGS='$BUG_REPORT' | tee $SCRIPT_DIR/logs/mx-$MX_VERSION-$FEATURE_BRANCH_NAME.log" +killall kore-rpc-booster || echo "No zombie processes found" + +if [ -z "$BUG_REPORT" ]; then +if [ ! -e "$SCRIPT_DIR/logs/mx-$MX_VERSION-master-$MASTER_COMMIT_SHORT.log" ]; then + master_shell "make -C kmxwasm test-booster && make -C kmxwasm test-integration | tee $SCRIPT_DIR/logs/mx-$MX_VERSION-master-$MASTER_COMMIT_SHORT.log" + killall kore-rpc-booster || echo "No zombie processes found" +fi + +cd $SCRIPT_DIR +python3 compare.py logs/mx-$MX_VERSION-$FEATURE_BRANCH_NAME.log logs/mx-$MX_VERSION-master-$MASTER_COMMIT_SHORT.log > logs/mx-$MX_VERSION-master-$MASTER_COMMIT_SHORT-$FEATURE_BRANCH_NAME-compare +fi \ No newline at end of file diff --git a/scripts/run-with-tarball.sh b/scripts/run-with-tarball.sh index d0570e53..0019d8ba 100755 --- a/scripts/run-with-tarball.sh +++ b/scripts/run-with-tarball.sh @@ -22,6 +22,8 @@ client=${CLIENT:-$booster/.build/booster/bin/kore-rpc-client} log_dir=${LOG_DIR:-.} SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" +# needed for the MX backend otherwise llvm-backend-matching crashes +export K_OPTS="$K_OPTS -Xmx16384m" nix_shell() { GC_DONT_GC=1 nix develop $SCRIPT_DIR/..#cabal --extra-experimental-features 'nix-command flakes' --command bash -c "$1" @@ -72,7 +74,7 @@ if [ -z "${LLVM_LIB}" ]; then #generate matching data (cd $TEMPD && mkdir -p dt && llvm-kompile-matching llvm-definition.kore qbaL ./dt 1/2) # find library dependencies and source files - for lib in libff libcryptopp libsecp256k1; do + for lib in libff libcryptopp blake2; do LIBFILE=$(find ${PLUGIN_DIR} -name "${lib}.a" | head -1) [ -z "$LIBFILE" ] && (echo "[Error] Unable to locate ${lib}.a"; exit 1) PLUGIN_LIBS+="$LIBFILE "