diff options
Diffstat (limited to 'script')
-rwxr-xr-x | script/spec-all-pairs | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/script/spec-all-pairs b/script/spec-all-pairs new file mode 100755 index 000000000..6f27e6b8e --- /dev/null +++ b/script/spec-all-pairs @@ -0,0 +1,66 @@ +#!/bin/bash + +# Try all ordered pairs of spec files, +# to winkle out order-dependent failures. + +test_pair () { + rake db:test:purge > /dev/null + rake db:test:clone_structure > /dev/null + if script/spec "$1" "$2" > /dev/null 2>&1 + then + echo "OK: $1 $2" + return 0 + else + echo "FAILED: $1 $2" + return 1 + fi +} + +all_pairs() { + specs=spec/*/*.rb + + for spec1 in $specs + do + all_okay=true + for spec2 in $specs + do + if ! test_pair "$spec1" "$spec2" + then + all_okay=false + fi + done + done + + $all_okay + return $? +} + +pairs_from_stdin() { + all_okay=true + while read line + do + case "$line" in + \*\ FAILED:\ *) + line=${line#\* FAILED: } + if ! test_pair $line + then + all_okay=false + fi + ;; + *) + echo "No match: $line" + ;; + esac + done + + $all_okay + return $? +} + +if [ "$1" = "-" ] +then + pairs_from_stdin +else + all_pairs +fi +exit $?
\ No newline at end of file |