public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
Seperate perf specs and run only through rake spec:perf not rake [spec], 
closes #50
Attempt to fix a couple more randomly failing specs.
macournoyer (author)
Sat Mar 01 21:55:16 -0800 2008
commit  33d56bcea0a23f3905b652b3a061b71ad89a4ddf
tree    0ba98456ba7030738f8aeaca6205759eb22f0c51
parent  a6a020260d568e81dbd3c120ba88e516b797a79c
...
45
46
47
48
 
49
50
51
52
...
45
46
47
 
48
49
50
51
52
0
@@ -45,7 +45,7 @@ module Thin
0
   class UnixConnection < Connection
0
     protected
0
       def socket_address
0
- '0.0.0.0' # Unix domain sockets can only be local
0
+ '127.0.0.1' # Unix domain sockets can only be local
0
       end
0
   end
0
 end
0
\ No newline at end of file
...
31
32
33
34
35
 
 
36
37
38
...
31
32
33
 
 
34
35
36
37
38
0
@@ -31,7 +31,7 @@ describe UnixConnection do
0
     @connection = UnixConnection.new(nil)
0
   end
0
   
0
- it "should return 0.0.0.0 as remote_address" do
0
- @connection.remote_address.should == '0.0.0.0'
0
+ it "should return 127.0.0.1 as remote_address" do
0
+ @connection.remote_address.should == '127.0.0.1'
0
   end
0
 end
0
\ No newline at end of file
...
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
...
51
52
53
 
 
 
 
 
 
 
 
54
 
 
 
55
56
57
0
@@ -51,18 +51,7 @@ describe Response do
0
     @response.each { |l| out << l }
0
     out.should include("\r\n\r\n<html></html>")
0
   end
0
-
0
- it "should be fast" do
0
- @response.body << <<-EOS
0
-<html><head><title>Dir listing</title></head>
0
-<body><h1>Listing stuff</h1><ul>
0
-#{'<li>Hi!</li>' * 100}
0
-</ul></body></html>
0
-EOS
0
     
0
- proc { @response.each { |l| l } }.should be_faster_then(0.00011)
0
- end
0
-
0
   it "should not be persistent by default" do
0
     @response.should_not be_persistent
0
   end
...
29
30
31
 
32
33
34
...
29
30
31
32
33
34
35
0
@@ -29,6 +29,7 @@ describe Server, "HTTP pipelining" do
0
     socket.write "GET /first HTTP/1.1\r\n\r\n"
0
     socket.flush
0
     socket.write "GET /second HTTP/1.1\r\nConnection: close\r\n\r\n"
0
+ socket.flush
0
     response = socket.read
0
     socket.close
0
     
...
35
36
37
38
39
40
41
42
43
44
45
46
 
47
48
49
...
35
36
37
 
 
 
 
 
 
 
 
 
38
39
40
41
0
@@ -35,15 +35,7 @@ describe Server, 'on TCP socket' do
0
     big = 'X' * (20 * 1024)
0
     post('/', :big => big).should include(big)
0
   end
0
-
0
- it "should handle GET in less then #{get_request_time = 0.0045} RubySecond" do
0
- proc { get('/') }.should be_faster_then(get_request_time)
0
- end
0
-
0
- it "should handle POST in less then #{post_request_time = 0.007} RubySecond" do
0
- proc { post('/', :file => 'X' * 1000) }.should be_faster_then(post_request_time)
0
- end
0
-
0
+
0
   it "should retreive remote address" do
0
     get('/').should include('"REMOTE_ADDR"=>"127.0.0.1"')
0
   end
...
12
13
14
15
16
17
18
19
 
20
21
22
...
12
13
14
 
 
 
 
 
15
16
17
18
0
@@ -12,11 +12,7 @@ describe Server, "on UNIX domain socket" do
0
   end
0
   
0
   it "should retreive remote address" do
0
- get('/').should include('"REMOTE_ADDR"=>""') # Is that right?
0
- end
0
-
0
- it "should handle GET in less then #{get_request_time = 0.002} RubySecond" do
0
- proc { get('/') }.should be_faster_then(get_request_time)
0
+ get('/').should include('"REMOTE_ADDR"=>"127.0.0.1"')
0
   end
0
   
0
   it "should remove socket file after server stops" do
...
1
2
3
 
4
5
6
7
8
9
10
11
12
13
 
14
15
16
...
21
22
23
 
24
25
 
 
 
 
 
 
26
27
28
29
30
 
31
32
33
34
 
35
36
...
1
2
 
3
4
5
6
7
 
8
9
10
11
 
12
13
14
15
...
20
21
22
23
24
 
25
26
27
28
29
30
31
 
32
33
 
34
35
36
37
 
38
39
40
0
@@ -1,16 +1,15 @@
0
 CLEAN.include %w(coverage tmp log)
0
 
0
-if RUBY_1_9
0
+if RUBY_1_9 # RSpec not yet working w/ Ruby 1.9
0
   task :spec do
0
     warn 'RSpec not yet supporting Ruby 1.9, so cannot run the specs :('
0
   end
0
 else
0
- # RSpec not yet working w/ Ruby 1.9
0
   require 'spec/rake/spectask'
0
   
0
   desc "Run all examples"
0
   Spec::Rake::SpecTask.new('spec') do |t|
0
- t.spec_files = FileList['spec/**/*_spec.rb']
0
+ t.spec_files = FileList['spec/**/*_spec.rb'] - FileList['spec/perf/*_spec.rb']
0
     if WIN
0
       t.spec_files -= [
0
           'spec/backends/unix_server_spec.rb',
0
@@ -21,15 +20,20 @@ else
0
           ]
0
     end
0
   end
0
+ task :spec => :compile
0
   
0
- task :check_spec_gems do
0
+ desc "Run all performance examples"
0
+ Spec::Rake::SpecTask.new('spec:perf') do |t|
0
+ t.spec_files = FileList['spec/perf/*_spec.rb']
0
+ end
0
+
0
+ task :check_benchmark_unit_gem do
0
     begin
0
- require 'spec'
0
       require 'benchmark_unit'
0
     rescue LoadError
0
- abort "To run specs, install rspec and benchmark_unit gems"
0
+ abort "To run specs, install benchmark_unit gem"
0
     end
0
   end
0
   
0
- task :spec => [:check_spec_gems, :compile]
0
+ task 'spec:perf' => :check_benchmark_unit_gem
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.