#!/bin/bash # usage: run_spec_n.sh # # Runs one isolation spec times against a single throwaway cluster # and counts the distinct outputs, and the runs where verify shows id 2 # twice. Each run gets 60 seconds; a run that hangs leaves backends waiting # on injection points, so the runs after it are not meaningful. P=$1; IT=$2; SPEC=$3; RUNS=$4; PORT=$5 D=/tmp/specn_$PORT rm -rf $D; mkdir -p $D/out $P/bin/initdb -D $D/data -U postgres --no-sync >/dev/null 2>&1 $P/bin/pg_ctl -D $D/data -o "-p $PORT -k /tmp" -l $D/log -w start >/dev/null trap '$P/bin/pg_ctl -D $D/data -m immediate -w stop >/dev/null 2>&1; rm -rf $D' EXIT for r in $(seq 1 $RUNS); do timeout 60 $IT "host=/tmp port=$PORT dbname=postgres user=postgres" < $SPEC > $D/out/$r 2>&1 || echo "run $r: exit $? (124 = timed out)" done echo "distinct outputs:" md5sum $D/out/* | awk '{print $1}' | sort | uniq -c echo "runs with id 2 twice: $(grep -lE '^ *2\| *2$' $D/out/* | wc -l)"