randomized-test-ci

 1#!/bin/bash
 2
 3# Compile the tests first
 4mkdir -p target
 5cargo test --release --package collab --no-run
 6if [[ $? != 0 ]]; then
 7  echo "Build failed"
 8  exit 1
 9fi
10
11set -eu
12
13LOG_FILE=target/randomized-tests.log
14export SAVE_PLAN=target/test-plan.json
15export OPERATIONS=200
16export ITERATIONS=10000
17export SEED=$(od -A n -N 8 -t u8 /dev/urandom | xargs)
18
19cargo test --release --package collab random -- --nocapture 2> >(tee $LOG_FILE)
20if [[ $? == 0 ]]; then
21  echo "Tests passed"
22  exit 0
23fi
24
25# If the tests failed, find the failing seed in the logs
26failing_seed=$(grep "failing seed" $LOG_FILE | cut -d: -f2 | xargs)
27echo "Tests failed. seed: $failing_seed"