diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d8f7e4aa..9a33c7319 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -248,7 +248,7 @@ Note that exploration uses the `chaos` mode so if you need to reproduce a run, u SEED=1234 ./whopper/bin/run --mode chaos ``` -Both `explore` and `run` accept `--enable-checksums` flag to enable per page checksums. +Both `explore` and `run` accept the `--enable-checksums` and `--enable-encryption` flags for per page checksums and encryption respectively. ## Python Bindings diff --git a/whopper/bin/explore b/whopper/bin/explore index c5480a3a7..6c664fffe 100755 --- a/whopper/bin/explore +++ b/whopper/bin/explore @@ -1,18 +1,34 @@ #!/bin/bash +# Usage: ./explore.sh [--enable-checksums|--enable-encryption] [other-args...] + set -e -# Check for special build time flags (e.g. `--enable-checksums`) +# Check for special build time flags (e.g. `--enable-checksums`, `--enable-encryption`) FEATURES="" ARGS=() +CHECKSUM_ENABLED=false +ENCRYPTION_ENABLED=false + for arg in "$@"; do if [[ "$arg" == "--enable-checksums" ]]; then FEATURES="--features checksum" + CHECKSUM_ENABLED=true + elif [[ "$arg" == "--enable-encryption" ]]; then + FEATURES="--features encryption" + ENCRYPTION_ENABLED=true + ARGS+=("$arg") else ARGS+=("$arg") fi done +# check for incompatible options +if [[ "$CHECKSUM_ENABLED" == true && "$ENCRYPTION_ENABLED" == true ]]; then + echo "Error: --enable-checksums and --enable-encryption are not compatible with each other" + exit 1 +fi + cargo build $FEATURES -p turso_whopper echo "Running Whopper in an infinite loop in 'chaos' mode..." diff --git a/whopper/bin/run b/whopper/bin/run index 8d6fc4b4e..79aead371 100755 --- a/whopper/bin/run +++ b/whopper/bin/run @@ -1,18 +1,34 @@ #!/bin/bash +# Usage: ./run.sh [--enable-checksums|--enable-encryption] [other-args...] + set -e -# Check for special build time flags (e.g. `--enable-checksums`) +# Check for special build time flags (e.g. `--enable-checksums`, `--enable-encryption`) FEATURES="" ARGS=() +CHECKSUM_ENABLED=false +ENCRYPTION_ENABLED=false + for arg in "$@"; do if [[ "$arg" == "--enable-checksums" ]]; then FEATURES="--features checksum" + CHECKSUM_ENABLED=true + elif [[ "$arg" == "--enable-encryption" ]]; then + FEATURES="--features encryption" + ENCRYPTION_ENABLED=true + ARGS+=("$arg") else ARGS+=("$arg") fi done +# check for incompatible options +if [[ "$CHECKSUM_ENABLED" == true && "$ENCRYPTION_ENABLED" == true ]]; then + echo "Error: --enable-checksums and --enable-encryption are not compatible with each other" + exit 1 +fi + cargo build $FEATURES -p turso_whopper time RUST_BACKTRACE=full ./target/debug/turso_whopper "${ARGS[@]}" \ No newline at end of file