aboutsummaryrefslogtreecommitdiffstats
path: root/script/spec-all-pairs
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-26 01:03:35 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-26 01:03:35 +0000
commit673b5cc3939e9abc3bc1f5984f2a61ed45b70529 (patch)
tree5b02800891270972a8946518f37fb807f2b9b7d8 /script/spec-all-pairs
parent0e546a79b205124d7b95b89e4a2e9cc520a4fc10 (diff)
parent6d7bea575ec185379efb648f6bbbd520029e3a91 (diff)
Merge branch 'release/0.5' into develop
Diffstat (limited to 'script/spec-all-pairs')
-rwxr-xr-xscript/spec-all-pairs70
1 files changed, 58 insertions, 12 deletions
diff --git a/script/spec-all-pairs b/script/spec-all-pairs
index 0d83f5837..6f27e6b8e 100755
--- a/script/spec-all-pairs
+++ b/script/spec-all-pairs
@@ -3,18 +3,64 @@
# Try all ordered pairs of spec files,
# to winkle out order-dependent failures.
-specs=spec/*/*.rb
+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
+}
-for spec1 in $specs
-do
- seen=false
- for spec2 in $specs
+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
- rake db:test:purge > /dev/null
- rake db:test:clone_structure > /dev/null
- if ! ( script/spec "$spec1" "$spec2" ) > /dev/null 2>&1
- then
- echo "FAILED: $spec1 $spec2"
- fi
+ case "$line" in
+ \*\ FAILED:\ *)
+ line=${line#\* FAILED: }
+ if ! test_pair $line
+ then
+ all_okay=false
+ fi
+ ;;
+ *)
+ echo "No match: $line"
+ ;;
+ esac
done
-done
+
+ $all_okay
+ return $?
+}
+
+if [ "$1" = "-" ]
+then
+ pairs_from_stdin
+else
+ all_pairs
+fi
+exit $? \ No newline at end of file