Skip to content

Commit db1d4b9

Browse files
committed
[Truffle] Add simple web servers to catch-all tests.
1 parent 64e45c0 commit db1d4b9

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

test/truffle/run.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,47 @@
11
#!/bin/bash
22

3+
PORT=8080
4+
5+
function wait_until_port_open {
6+
until lsof -i :$PORT
7+
do
8+
sleep 1
9+
done
10+
sleep 1
11+
}
12+
313
echo "Building..."
414
mvn install -Pbootstrap
515

616
echo "Array#pack with real usage..."
717
bin/jruby -X+T test/truffle/pack-real-usage.rb
18+
19+
echo "Simple web server..."
20+
bin/jruby -X+T test/truffle/simple-server.rb &
21+
wait_until_port_open
22+
curl http://localhost:$PORT/
23+
kill -9 $!
24+
wait
25+
26+
echo "Simple Webrick web server..."
27+
bin/jruby -X+T test/truffle/simple-webrick-server.rb &
28+
wait_until_port_open
29+
curl http://localhost:$PORT/
30+
kill -9 $!
31+
wait
32+
33+
echo "Simple Rack web server..."
34+
bin/jruby bin/gem install rack
35+
bin/jruby -X+T -Ilib/ruby/gems/shared/gems/rack-1.6.1/lib test/truffle/simple-webrick-server.rb &
36+
wait_until_port_open
37+
curl http://localhost:$PORT/
38+
kill -9 $!
39+
wait
40+
41+
echo "Simple Sinatra web server..."
42+
bin/jruby bin/gem install sinatra
43+
bin/jruby -X+T -Ilib/ruby/gems/shared/gems/rack-1.6.1/lib -Ilib/ruby/gems/shared/gems/tilt-2.0.1/lib -Ilib/ruby/gems/shared/gems/rack-protection-1.5.3/lib -Ilib/ruby/gems/shared/gems/sinatra-1.4.6/lib test/truffle/simple-sinatra-server.rb &
44+
wait_until_port_open
45+
curl http://localhost:$PORT/
46+
kill -9 $!
47+
wait

test/truffle/simple-sinatra-server.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
require 'sinatra'
22

33
# bin/jruby bin/gem install sinatra
4-
# jt run -Ilib/ruby/gems/shared/gems/rack-1.6.1/lib -Ilib/ruby/gems/shared/gems/rack-protection-1.5.3/lib -Ilib/ruby/gems/shared/gems/sinatra-1.4.6/lib test/truffle/simple-sinatra-server.rb
5-
get '/hello' do
4+
# jt run -Ilib/ruby/gems/shared/gems/rack-1.6.1/lib -Ilib/ruby/gems/shared/gems/tilt-2.0.1/lib -Ilib/ruby/gems/shared/gems/rack-protection-1.5.3/lib -Ilib/ruby/gems/shared/gems/sinatra-1.4.6/lib test/truffle/simple-sinatra-server.rb
5+
6+
set :port, 8080
7+
8+
get '/' do
69
"Hello Sinatra!"
710
end

0 commit comments

Comments
 (0)