zed/script/randomized-test-ci
2023-04-14 14:25:55 -07:00

27 lines
651 B
Bash
Executable file

#!/bin/bash
# Compile the tests first
mkdir -p target
cargo test --release --package collab --no-run
if [[ $? != 0 ]]; then
echo "Build failed"
exit 1
fi
set -eu
LOG_FILE=target/randomized-tests.log
export SAVE_PLAN=target/test-plan.json
export OPERATIONS=200
export ITERATIONS=10000
export SEED=$(od -A n -N 8 -t u8 /dev/urandom | xargs)
cargo test --release --package collab random -- --nocapture 2> >(tee $LOG_FILE)
if [[ $? == 0 ]]; then
echo "Tests passed"
exit 0
fi
# If the tests failed, find the failing seed in the logs
failing_seed=$(grep "failing seed" $LOG_FILE | cut -d: -f2 | xargs)
echo "Tests failed. seed: $failing_seed"