diff options
Diffstat (limited to 'script')
-rwxr-xr-x | script/load-sample-data | 12 | ||||
-rwxr-xr-x | script/rebuild-xapian-index | 4 | ||||
-rwxr-xr-x | script/spec-all-pairs | 70 |
3 files changed, 69 insertions, 17 deletions
diff --git a/script/load-sample-data b/script/load-sample-data index 0521ef849..84b8a28eb 100755 --- a/script/load-sample-data +++ b/script/load-sample-data @@ -6,7 +6,15 @@ LOC=`dirname $0` rake --silent spec:db:fixtures:load -"$LOC/runner" 'puts File.expand_path(File.dirname(__FILE__) + "/spec/spec_helper"); require File.expand_path(File.dirname(__FILE__) + "/spec/spec_helper"); RawEmail.all().each {|email| email.data = load_file_fixture("useless_raw_email.email")}' +"$LOC/runner" /dev/stdin <<END +env = ENV["RAILS_ENV"] +require "spec/spec_helper.rb" # Sets RAILS_ENV to 'test' +ENV["RAILS_ENV"] = env +RawEmail.all().each do |email| + puts "Writing #{email.filepath}" + email.data = load_file_fixture("useless_raw_email.email") +end +END -echo "Loaded fixtures."
\ No newline at end of file +echo "Loaded fixtures." diff --git a/script/rebuild-xapian-index b/script/rebuild-xapian-index index 11e4a46be..5986f5259 100755 --- a/script/rebuild-xapian-index +++ b/script/rebuild-xapian-index @@ -1,6 +1,4 @@ #!/bin/bash cd `dirname $0` -rake --silent xapian:rebuild_index models="PublicBody User InfoRequestEvent" - - +rake --silent "$@" xapian:rebuild_index models="PublicBody User InfoRequestEvent" 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 |