aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-24 13:04:54 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-24 13:04:54 +0000
commit3784b36836f206e2a781175f2be0ee7901c36fc3 (patch)
tree6f1efb4b13b88e6dee195349233f876447d7fb08 /script
parentd695b97e5580c5fbe1e68d3d02b9d475a6470ced (diff)
Make it possible to test just particular pairs
For example to re-run all the failed pairs including general_controller_spec.rb: fgrep /general_controller_spec ../test-pair-failures.txt | script/spec-all-pairs -
Diffstat (limited to 'script')
-rwxr-xr-xscript/spec-all-pairs58
1 files changed, 46 insertions, 12 deletions
diff --git a/script/spec-all-pairs b/script/spec-all-pairs
index d1b6c87ea..3604e8111 100755
--- a/script/spec-all-pairs
+++ b/script/spec-all-pairs
@@ -3,23 +3,57 @@
# 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
+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
- for spec2 in $specs
+ 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
+ line=${line#\* FAILED: }
+ if ! test_pair $line
then
- echo "OK: $spec1 $spec2"
- else
- echo "FAILED: $spec1 $spec2"
all_okay=false
fi
done
-done
+
+ $all_okay
+ return $?
+}
-exec $all_okay
+if [ "$1" = "-" ]
+then
+ pairs_from_stdin
+else
+ all_pairs
+fi
+exit $? \ No newline at end of file