forked from sparklemotion/nokogiri
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_all
executable file
·84 lines (74 loc) · 2.22 KB
/
test_all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#! /usr/bin/env bash
#
# script to run tests on all relevant rubies, and valgrind on supported rubies.
# outputs tests to `test.log` and valgrind output to `valgrind.log`.
#
# requires `rvm` to be installed. sorry about that, multiruby dudes.
#
RUBIES="ruby-1.9.3 jruby-1.6.5 ree-1.8.7 ruby-1.9.2 ruby-1.8.7"
TEST_LOG=test.log
VALGRIND_LOG=valgrind.log
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
source "/usr/local/rvm/scripts/rvm"
else
echo "ERROR: An RVM installation was not found.\n"
fi
> $TEST_LOG
> $VALGRIND_LOG
set -o errexit
function rvm_use {
current_ruby=$1
rvm use "${1}@nokogiri" --create
}
function generate_parser_and_tokenizer {
old_ruby=$current_ruby
rvm_use ruby-1.8.7
bundle exec rake generate 2>&1 > /dev/null
rvm_use $old_ruby
}
function clean {
bundle exec rake clean clobber 2>&1 > /dev/null
}
function compile {
echo "** compiling ..."
generate_parser_and_tokenizer
bundle exec rake compile 2>&1 > /dev/null
}
for ruby in $RUBIES ; do
rvm_use ${ruby}
if gem list bundler | fgrep -v 1.1.rc 2>&1 > /dev/null ; then
gem install bundler --pre
fi
bundle install --quiet --local || bundle install
clean
done
for ruby in $RUBIES ; do
rvm_use ${ruby}
echo -e "**\n** testing nokogiri on ${ruby}\n**" | tee -a $TEST_LOG
clean
compile
echo "** running tests ..."
if [[ $ruby =~ "jruby" ]] ; then
# I get:
# /usr/lib/jvm/java-7-oracle/bin/java: symbol lookup error: /home/mike/.rvm/gems/jruby-1.6.5@nokogiri/gems/racc-1.4.7/lib/racc/cparse.so: undefined symbol: rb_catch
# if I use 'bundle exec' with jruby. Anybody?
rake test 2>&1 | tee -a $TEST_LOG
else
bundle exec rake test 2>&1 | tee -a $TEST_LOG
fi
clean
done
for ruby in $RUBIES ; do
if [[ ! $ruby =~ "jruby" ]] ; then
rvm_use ${ruby}
echo -e "**\n** nokogiri prerelease: ${ruby}\n**" | tee -a $VALGRIND_LOG
clean
compile
echo "** running valgrind on tests ..."
bundle exec rake test:valgrind 2>&1 | tee -a $VALGRIND_LOG
clean
fi
done