rainbows 4.4.3 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +1 -0
- data/.gitignore +1 -0
- data/Documentation/rainbows.1.txt +8 -4
- data/GIT-VERSION-GEN +34 -35
- data/GNUmakefile +4 -2
- data/HACKING +72 -0
- data/bin/rainbows +5 -0
- data/lib/rainbows/const.rb +3 -3
- data/lib/rainbows/coolio/client.rb +18 -6
- data/lib/rainbows/coolio/thread_client.rb +2 -0
- data/lib/rainbows/epoll/client.rb +35 -12
- data/lib/rainbows/ev_core.rb +5 -4
- data/lib/rainbows/event_machine/client.rb +9 -4
- data/lib/rainbows/process_client.rb +7 -3
- data/lib/rainbows/response.rb +54 -18
- data/lib/rainbows/revactor/client/methods.rb +1 -1
- data/lib/rainbows/stream_response_epoll.rb +34 -15
- data/lib/rainbows/stream_response_epoll/client.rb +11 -3
- data/lib/rainbows/writer_thread_pool/client.rb +2 -0
- data/lib/rainbows/xepoll/client.rb +0 -3
- data/lib/rainbows/xepoll_thread_pool/client.rb +1 -1
- data/lib/rainbows/xepoll_thread_spawn/client.rb +1 -1
- data/rainbows.gemspec +6 -3
- data/t/GNUmakefile +10 -3
- data/t/byte-range-common.sh +1 -1
- data/t/hijack.ru +56 -0
- data/t/t0000-simple-http.sh +9 -9
- data/t/t0001-unix-http.sh +8 -8
- data/t/t0003-reopen-logs.sh +8 -8
- data/t/t0004-heartbeat-timeout.sh +3 -3
- data/t/t0005-large-file-response.sh +1 -1
- data/t/t0010-keepalive-timeout-effective.sh +2 -2
- data/t/t0011-close-on-exec-set.sh +2 -2
- data/t/t0017-keepalive-timeout-zero.sh +2 -2
- data/t/t0024-pipelined-sendfile-response.sh +2 -2
- data/t/t0027-nil-copy_stream.sh +1 -1
- data/t/t0030-fast-pipe-response.sh +1 -1
- data/t/t0034-pipelined-pipe-response.sh +2 -2
- data/t/t0035-kgio-pipe-response.sh +1 -1
- data/t/t0040-keepalive_requests-setting.sh +4 -4
- data/t/t0043-quit-keepalive-disconnect.sh +3 -3
- data/t/t0044-autopush.sh +2 -2
- data/t/t0045-client_max_header_size.sh +2 -2
- data/t/t0100-rack-input-hammer-chunked.sh +4 -4
- data/t/t0100-rack-input-hammer-content-length.sh +4 -4
- data/t/t0106-rack-input-keepalive.sh +6 -6
- data/t/t0200-async-response.sh +5 -5
- data/t/t0202-async-response-one-oh.sh +5 -5
- data/t/t0300-async_sinatra.sh +5 -5
- data/t/t0400-em-async-app.sh +2 -2
- data/t/t0401-em-async-tailer.sh +2 -2
- data/t/t0402-async-keepalive.sh +23 -23
- data/t/t0500-cramp-streaming.sh +3 -3
- data/t/t0600-rack-fiber_pool.sh +1 -1
- data/t/t0700-app-deferred.sh +2 -2
- data/t/t0800-rack-hijack.sh +27 -0
- data/t/t9000-rack-app-pool.sh +3 -3
- data/t/t9001-sendfile-to-path.sh +1 -1
- data/t/t9100-thread-timeout.sh +1 -1
- data/t/t9101-thread-timeout-threshold.sh +1 -1
- data/t/test-lib.sh +15 -0
- data/t/test_isolate.rb +4 -3
- metadata +26 -6
- data/t/bin/utee +0 -12
data/t/hijack.ru
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
use Rack::Lint
|
2
|
+
use Rack::ContentLength
|
3
|
+
use Rack::ContentType, "text/plain"
|
4
|
+
class DieIfUsed
|
5
|
+
def each
|
6
|
+
abort "body.each called after response hijack\n"
|
7
|
+
end
|
8
|
+
|
9
|
+
def close
|
10
|
+
abort "body.close called after response hijack\n"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
def lazy_close(io)
|
14
|
+
thr = Thread.new do
|
15
|
+
# wait and see if Rainbows! accidentally closes us
|
16
|
+
sleep((ENV["DELAY"] || 10).to_i)
|
17
|
+
begin
|
18
|
+
io.close
|
19
|
+
rescue => e
|
20
|
+
warn "E: #{e.message} (#{e.class})"
|
21
|
+
exit!(3)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
at_exit { thr.join }
|
25
|
+
end
|
26
|
+
|
27
|
+
run lambda { |env|
|
28
|
+
case env["PATH_INFO"]
|
29
|
+
when "/hijack_req"
|
30
|
+
if env["rack.hijack?"]
|
31
|
+
io = env["rack.hijack"].call
|
32
|
+
if io.respond_to?(:read_nonblock) &&
|
33
|
+
env["rack.hijack_io"].respond_to?(:read_nonblock)
|
34
|
+
|
35
|
+
# exercise both, since we Rack::Lint may use different objects
|
36
|
+
env["rack.hijack_io"].write("HTTP/1.0 200 OK\r\n\r\n")
|
37
|
+
io.write("request.hijacked")
|
38
|
+
lazy_close(io)
|
39
|
+
return [ 500, {}, DieIfUsed.new ]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
[ 500, {}, [ "hijack BAD\n" ] ]
|
43
|
+
when "/hijack_res"
|
44
|
+
r = "response.hijacked"
|
45
|
+
[ 200,
|
46
|
+
{
|
47
|
+
"Content-Length" => r.bytesize.to_s,
|
48
|
+
"rack.hijack" => proc do |io|
|
49
|
+
io.write(r)
|
50
|
+
lazy_close(io)
|
51
|
+
end
|
52
|
+
},
|
53
|
+
DieIfUsed.new
|
54
|
+
]
|
55
|
+
end
|
56
|
+
}
|
data/t/t0000-simple-http.sh
CHANGED
@@ -60,19 +60,19 @@ t_begin "pipelining partial requests" && {
|
|
60
60
|
dbgcat tmp
|
61
61
|
|
62
62
|
t_begin "two HTTP/1.1 responses" && {
|
63
|
-
test 2 -eq $(grep '^HTTP/1.1' $tmp |
|
63
|
+
test 2 -eq $(grep '^HTTP/1.1' $tmp | count_lines)
|
64
64
|
}
|
65
65
|
|
66
66
|
t_begin "two HTTP/1.1 200 OK responses" && {
|
67
|
-
test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp |
|
67
|
+
test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | count_lines)
|
68
68
|
}
|
69
69
|
|
70
70
|
t_begin 'one "Connection: keep-alive" response' && {
|
71
|
-
test 1 -eq $(grep '^Connection: keep-alive' $tmp |
|
71
|
+
test 1 -eq $(grep '^Connection: keep-alive' $tmp | count_lines)
|
72
72
|
}
|
73
73
|
|
74
74
|
t_begin 'one "Connection: close" response' && {
|
75
|
-
test 1 -eq $(grep '^Connection: close' $tmp |
|
75
|
+
test 1 -eq $(grep '^Connection: close' $tmp | count_lines)
|
76
76
|
}
|
77
77
|
|
78
78
|
t_begin 'check subshell success' && {
|
@@ -98,19 +98,19 @@ dbgcat tmp
|
|
98
98
|
dbgcat r_err
|
99
99
|
|
100
100
|
t_begin "got 2 HTTP/1.1 responses from pipelining" && {
|
101
|
-
test 2 -eq $(grep '^HTTP/1.1' $tmp |
|
101
|
+
test 2 -eq $(grep '^HTTP/1.1' $tmp | count_lines)
|
102
102
|
}
|
103
103
|
|
104
104
|
t_begin "got 2 HTTP/1.1 200 OK responses" && {
|
105
|
-
test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp |
|
105
|
+
test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | count_lines)
|
106
106
|
}
|
107
107
|
|
108
108
|
t_begin "one keepalive connection" && {
|
109
|
-
test 1 -eq $(grep '^Connection: keep-alive' $tmp |
|
109
|
+
test 1 -eq $(grep '^Connection: keep-alive' $tmp | count_lines)
|
110
110
|
}
|
111
111
|
|
112
112
|
t_begin "second request closes connection" && {
|
113
|
-
test 1 -eq $(grep '^Connection: close' $tmp |
|
113
|
+
test 1 -eq $(grep '^Connection: close' $tmp | count_lines)
|
114
114
|
}
|
115
115
|
|
116
116
|
t_begin "subshell exited correctly" && {
|
@@ -134,7 +134,7 @@ dbgcat tmp
|
|
134
134
|
dbgcat r_err
|
135
135
|
|
136
136
|
t_begin "env.inspect should've put everything on one line" && {
|
137
|
-
test 1 -eq $(
|
137
|
+
test 1 -eq $(count_lines < $tmp)
|
138
138
|
}
|
139
139
|
|
140
140
|
t_begin "no headers in output" && {
|
data/t/t0001-unix-http.sh
CHANGED
@@ -51,19 +51,19 @@ t_begin "pipelining partial requests" && {
|
|
51
51
|
dbgcat tmp
|
52
52
|
|
53
53
|
t_begin "two HTTP/1.1 responses" && {
|
54
|
-
test 2 -eq $(grep '^HTTP/1.1' $tmp |
|
54
|
+
test 2 -eq $(grep '^HTTP/1.1' $tmp | count_lines)
|
55
55
|
}
|
56
56
|
|
57
57
|
t_begin "two HTTP/1.1 200 OK responses" && {
|
58
|
-
test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp |
|
58
|
+
test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | count_lines)
|
59
59
|
}
|
60
60
|
|
61
61
|
t_begin 'one "Connection: keep-alive" response' && {
|
62
|
-
test 1 -eq $(grep '^Connection: keep-alive' $tmp |
|
62
|
+
test 1 -eq $(grep '^Connection: keep-alive' $tmp | count_lines)
|
63
63
|
}
|
64
64
|
|
65
65
|
t_begin 'one "Connection: close" response' && {
|
66
|
-
test 1 -eq $(grep '^Connection: close' $tmp |
|
66
|
+
test 1 -eq $(grep '^Connection: close' $tmp | count_lines)
|
67
67
|
}
|
68
68
|
|
69
69
|
t_begin 'check subshell success' && {
|
@@ -89,19 +89,19 @@ dbgcat tmp
|
|
89
89
|
dbgcat r_err
|
90
90
|
|
91
91
|
t_begin "two HTTP/1.1 responses" && {
|
92
|
-
test 2 -eq $(grep '^HTTP/1.1' $tmp |
|
92
|
+
test 2 -eq $(grep '^HTTP/1.1' $tmp | count_lines)
|
93
93
|
}
|
94
94
|
|
95
95
|
t_begin "two HTTP/1.1 200 OK responses" && {
|
96
|
-
test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp |
|
96
|
+
test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | count_lines)
|
97
97
|
}
|
98
98
|
|
99
99
|
t_begin 'one "Connection: keep-alive" response' && {
|
100
|
-
test 1 -eq $(grep '^Connection: keep-alive' $tmp |
|
100
|
+
test 1 -eq $(grep '^Connection: keep-alive' $tmp | count_lines)
|
101
101
|
}
|
102
102
|
|
103
103
|
t_begin 'one "Connection: close" response' && {
|
104
|
-
test 1 -eq $(grep '^Connection: close' $tmp |
|
104
|
+
test 1 -eq $(grep '^Connection: close' $tmp | count_lines)
|
105
105
|
}
|
106
106
|
|
107
107
|
t_begin 'check subshell success' && {
|
data/t/t0003-reopen-logs.sh
CHANGED
@@ -17,7 +17,7 @@ t_begin "ensure server is responsive" && {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
t_begin "start $nr_client concurrent requests" && {
|
20
|
-
start=$(
|
20
|
+
start=$(unix_time)
|
21
21
|
for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
|
22
22
|
do
|
23
23
|
( curl -sSf http://$listen/2 >> $curl_out 2>> $curl_err ) &
|
@@ -59,7 +59,7 @@ dbgcat r_err
|
|
59
59
|
|
60
60
|
t_begin "wait curl requests to finish" && {
|
61
61
|
wait
|
62
|
-
t_info elapsed=$(( $(
|
62
|
+
t_info elapsed=$(( $(unix_time) - $start ))
|
63
63
|
}
|
64
64
|
|
65
65
|
t_begin "ensure no errors from curl" && {
|
@@ -67,11 +67,11 @@ t_begin "ensure no errors from curl" && {
|
|
67
67
|
}
|
68
68
|
|
69
69
|
t_begin "curl got $nr_client responses" && {
|
70
|
-
test "$(
|
70
|
+
test "$(count_lines < $curl_out)" -eq $nr_client
|
71
71
|
}
|
72
72
|
|
73
73
|
t_begin "all responses were identical" && {
|
74
|
-
nr=$(sort < $curl_out | uniq |
|
74
|
+
nr=$(sort < $curl_out | uniq | count_lines)
|
75
75
|
test "$nr" -eq 1
|
76
76
|
}
|
77
77
|
|
@@ -86,11 +86,11 @@ t_begin "rotated stderr is clean" && {
|
|
86
86
|
}
|
87
87
|
|
88
88
|
t_begin "server is now writing logs to new stderr" && {
|
89
|
-
before_rot=$(
|
90
|
-
before_err=$(
|
89
|
+
before_rot=$(count_bytes < $r_rot)
|
90
|
+
before_err=$(count_bytes < $r_err)
|
91
91
|
curl -sSfv http://$listen/
|
92
|
-
after_rot=$(
|
93
|
-
after_err=$(
|
92
|
+
after_rot=$(count_bytes < $r_rot)
|
93
|
+
after_err=$(count_bytes < $r_err)
|
94
94
|
test $after_rot -eq $before_rot
|
95
95
|
test $after_err -gt $before_err
|
96
96
|
}
|
@@ -23,9 +23,9 @@ t_begin "sleep for a bit, ensure worker PID does not change" && {
|
|
23
23
|
|
24
24
|
t_begin "block the worker process to force it to die" && {
|
25
25
|
rm $ok
|
26
|
-
t0=$(
|
26
|
+
t0=$(unix_time)
|
27
27
|
err="$(curl -sSf http://$listen/block-forever 2>&1 || > $ok)"
|
28
|
-
t1=$(
|
28
|
+
t1=$(unix_time)
|
29
29
|
elapsed=$(($t1 - $t0))
|
30
30
|
t_info "elapsed=$elapsed err=$err"
|
31
31
|
test x"$err" != x"Should never get here"
|
@@ -34,7 +34,7 @@ t_begin "block the worker process to force it to die" && {
|
|
34
34
|
|
35
35
|
t_begin "ensure worker was killed" && {
|
36
36
|
test -e $ok
|
37
|
-
test 1 -eq $(grep timeout $r_err | grep killing |
|
37
|
+
test 1 -eq $(grep timeout $r_err | grep killing | count_lines)
|
38
38
|
}
|
39
39
|
|
40
40
|
t_begin "ensure timeout took at least 3 seconds" && {
|
@@ -21,7 +21,7 @@ t_begin "setup and startup" && {
|
|
21
21
|
|
22
22
|
t_begin "read random blob sha1 and size" && {
|
23
23
|
random_blob_sha1=$(rsha1 < random_blob)
|
24
|
-
random_blob_size=$(
|
24
|
+
random_blob_size=$(count_bytes < random_blob)
|
25
25
|
}
|
26
26
|
|
27
27
|
t_begin "read current RSS" && {
|
@@ -16,12 +16,12 @@ t_begin 'check server up' && {
|
|
16
16
|
|
17
17
|
t_begin "send keepalive response that does not expect close" && {
|
18
18
|
req='GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'
|
19
|
-
t0=$(
|
19
|
+
t0=$(unix_time)
|
20
20
|
(
|
21
21
|
cat $fifo > $tmp &
|
22
22
|
printf "$req"
|
23
23
|
wait
|
24
|
-
|
24
|
+
unix_time > $ok
|
25
25
|
) | socat - TCP:$listen > $fifo
|
26
26
|
now="$(cat $ok)"
|
27
27
|
elapsed=$(( $now - $t0 ))
|
@@ -13,12 +13,12 @@ t_begin "setup and start" && {
|
|
13
13
|
|
14
14
|
t_begin "send keepalive req expect it to timeout in ~1s" && {
|
15
15
|
req='GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'
|
16
|
-
t0=$(
|
16
|
+
t0=$(unix_time)
|
17
17
|
(
|
18
18
|
cat $fifo > $tmp &
|
19
19
|
printf "$req"
|
20
20
|
wait
|
21
|
-
|
21
|
+
unix_time > $ok
|
22
22
|
) | socat - TCP:$listen > $fifo
|
23
23
|
now="$(cat $ok)"
|
24
24
|
elapsed=$(( $now - $t0 ))
|
@@ -16,12 +16,12 @@ t_begin 'check server responds with Connection: close' && {
|
|
16
16
|
|
17
17
|
t_begin "send keepalive response that does not expect close" && {
|
18
18
|
req='GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'
|
19
|
-
t0=$(
|
19
|
+
t0=$(unix_time)
|
20
20
|
(
|
21
21
|
cat $fifo > $tmp &
|
22
22
|
printf "$req"
|
23
23
|
wait
|
24
|
-
|
24
|
+
unix_time > $ok
|
25
25
|
) | socat - TCP:$listen > $fifo
|
26
26
|
now="$(cat $ok)"
|
27
27
|
elapsed=$(( $now - $t0 ))
|
@@ -63,7 +63,7 @@ t_begin "staggered pipeline of 3 HTTP requests" && {
|
|
63
63
|
wait
|
64
64
|
echo ok >> $ok
|
65
65
|
) | socat - TCP:$listen > $dd_fifo
|
66
|
-
test 2 -eq $(grep '^ok$' $ok |
|
66
|
+
test 2 -eq $(grep '^ok$' $ok |count_lines)
|
67
67
|
}
|
68
68
|
|
69
69
|
t_begin "pipeline 3 HTTP requests" && {
|
@@ -78,7 +78,7 @@ t_begin "pipeline 3 HTTP requests" && {
|
|
78
78
|
wait
|
79
79
|
echo ok >> $ok
|
80
80
|
) | socat - TCP:$listen > $fifo
|
81
|
-
test 2 -eq $(grep '^ok$' $ok |
|
81
|
+
test 2 -eq $(grep '^ok$' $ok |count_lines)
|
82
82
|
}
|
83
83
|
|
84
84
|
t_begin "shutdown server" && {
|
data/t/t0027-nil-copy_stream.sh
CHANGED
@@ -19,7 +19,7 @@ EOF
|
|
19
19
|
|
20
20
|
t_begin "read random blob sha1 and size" && {
|
21
21
|
random_blob_sha1=$(rsha1 < random_blob)
|
22
|
-
random_blob_size=$(
|
22
|
+
random_blob_size=$(count_bytes < random_blob)
|
23
23
|
}
|
24
24
|
|
25
25
|
t_begin "send a series HTTP/1.1 requests sequentially" && {
|
@@ -35,7 +35,7 @@ t_begin "send three keep-alive requests" && {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
t_begin "ensure responses were all keep-alive" && {
|
38
|
-
test 3 -eq $(grep '< Connection: keep-alive' < $err |
|
38
|
+
test 3 -eq $(grep '< Connection: keep-alive' < $err | count_lines)
|
39
39
|
}
|
40
40
|
|
41
41
|
t_begin "HTTP/1.0 test" && {
|
@@ -62,7 +62,7 @@ t_begin "staggered pipeline of 3 HTTP requests" && {
|
|
62
62
|
wait
|
63
63
|
echo ok >> $ok
|
64
64
|
) | socat - TCP:$listen > $dd_fifo
|
65
|
-
test 2 -eq $(grep '^ok$' $ok |
|
65
|
+
test 2 -eq $(grep '^ok$' $ok |count_lines)
|
66
66
|
}
|
67
67
|
|
68
68
|
t_begin "pipeline 3 HTTP requests" && {
|
@@ -77,7 +77,7 @@ t_begin "pipeline 3 HTTP requests" && {
|
|
77
77
|
wait
|
78
78
|
echo ok >> $ok
|
79
79
|
) | socat - TCP:$listen > $fifo
|
80
|
-
test 2 -eq $(grep '^ok$' $ok |
|
80
|
+
test 2 -eq $(grep '^ok$' $ok |count_lines)
|
81
81
|
}
|
82
82
|
|
83
83
|
t_begin "shutdown server" && {
|
@@ -35,7 +35,7 @@ t_begin "send three keep-alive requests" && {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
t_begin "ensure responses were all keep-alive" && {
|
38
|
-
test 3 -eq $(grep '< Connection: keep-alive' < $err |
|
38
|
+
test 3 -eq $(grep '< Connection: keep-alive' < $err | count_lines)
|
39
39
|
}
|
40
40
|
|
41
41
|
t_begin "HTTP/1.0 test" && {
|
@@ -13,8 +13,8 @@ t_begin "setup and start" && {
|
|
13
13
|
|
14
14
|
t_begin "curl requests hit default keepalive_requests limit" && {
|
15
15
|
curl -sSfv http://$listen/[0-101] > $curl_out 2> $curl_err
|
16
|
-
test 1 -eq $(grep 'Connection: close' $curl_err |
|
17
|
-
test 101 -eq $(grep 'Connection: keep-alive' $curl_err |
|
16
|
+
test 1 -eq $(grep 'Connection: close' $curl_err |count_lines)
|
17
|
+
test 101 -eq $(grep 'Connection: keep-alive' $curl_err |count_lines)
|
18
18
|
}
|
19
19
|
|
20
20
|
t_begin "reload with smaller keepalive_requests limit" && {
|
@@ -32,8 +32,8 @@ EOF
|
|
32
32
|
t_begin "curl requests hit smaller keepalive_requests limit" && {
|
33
33
|
rm -f $curl_out $curl_err
|
34
34
|
curl -sSfv http://$listen/[1-13] > $curl_out 2> $curl_err
|
35
|
-
test 2 -eq $(grep 'Connection: close' $curl_err |
|
36
|
-
test 11 -eq $(grep 'Connection: keep-alive' $curl_err |
|
35
|
+
test 2 -eq $(grep 'Connection: close' $curl_err |count_lines)
|
36
|
+
test 11 -eq $(grep 'Connection: keep-alive' $curl_err |count_lines)
|
37
37
|
}
|
38
38
|
|
39
39
|
t_begin "killing succeeds" && {
|
@@ -33,13 +33,13 @@ t_begin "wait for response" && {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
t_begin "stop Rainbows! gracefully" && {
|
36
|
-
t0=$(
|
36
|
+
t0=$(unix_time)
|
37
37
|
kill -QUIT $rainbows_pid
|
38
38
|
}
|
39
39
|
|
40
40
|
t_begin "keepalive client disconnected quickly" && {
|
41
41
|
wait
|
42
|
-
diff=$(( $(
|
42
|
+
diff=$(( $(unix_time) - $t0 ))
|
43
43
|
test $diff -le 2 || die "client diff=$diff > 2"
|
44
44
|
}
|
45
45
|
|
@@ -48,7 +48,7 @@ t_begin "wait for termination" && {
|
|
48
48
|
do
|
49
49
|
sleep 1
|
50
50
|
done
|
51
|
-
diff=$(( $(
|
51
|
+
diff=$(( $(unix_time) - $t0 ))
|
52
52
|
test $diff -le 4 || die "server diff=$diff > 4"
|
53
53
|
}
|
54
54
|
|
data/t/t0044-autopush.sh
CHANGED
@@ -37,7 +37,7 @@ start_strace () {
|
|
37
37
|
|
38
38
|
check_TCP_CORK () {
|
39
39
|
nr=0
|
40
|
-
while test 2 -gt $(grep TCP_CORK $strace_out |
|
40
|
+
while test 2 -gt $(grep TCP_CORK $strace_out | count_lines)
|
41
41
|
do
|
42
42
|
nr=$(( $nr + 1 ))
|
43
43
|
if test $nr -gt 30
|
@@ -48,7 +48,7 @@ check_TCP_CORK () {
|
|
48
48
|
sleep 1
|
49
49
|
done
|
50
50
|
|
51
|
-
test 2 -eq $(grep TCP_CORK $strace_out |
|
51
|
+
test 2 -eq $(grep TCP_CORK $strace_out | count_lines)
|
52
52
|
fgrep 'SOL_TCP, TCP_CORK, [0],' $strace_out
|
53
53
|
fgrep 'SOL_TCP, TCP_CORK, [1],' $strace_out
|
54
54
|
}
|
@@ -54,7 +54,7 @@ t_begin "smallest HTTP/0.9 request works right" && {
|
|
54
54
|
) | socat - TCP:$listen > $fifo
|
55
55
|
wait
|
56
56
|
test xok = x"$(cat $ok)"
|
57
|
-
test 1 -eq $(
|
57
|
+
test 1 -eq $(count_lines < $tmp)
|
58
58
|
grep HTTP_VERSION $tmp && die "unexpected HTTP_VERSION in HTTP/0.9 request"
|
59
59
|
}
|
60
60
|
|
@@ -75,7 +75,7 @@ EOF
|
|
75
75
|
|
76
76
|
t_begin "HTTP/1.1 request succeeds" && {
|
77
77
|
curl -sSf http://$listen/ > $tmp
|
78
|
-
test 1 -eq $(
|
78
|
+
test 1 -eq $(count_lines < $tmp)
|
79
79
|
dbgcat tmp
|
80
80
|
}
|
81
81
|
|
@@ -17,7 +17,7 @@ t_begin "setup and startup" && {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
t_begin "send $nr_client concurrent requests" && {
|
20
|
-
start=$(
|
20
|
+
start=$(unix_time)
|
21
21
|
for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
|
22
22
|
do
|
23
23
|
(
|
@@ -26,17 +26,17 @@ t_begin "send $nr_client concurrent requests" && {
|
|
26
26
|
) &
|
27
27
|
done
|
28
28
|
wait
|
29
|
-
t_info elapsed=$(( $(
|
29
|
+
t_info elapsed=$(( $(unix_time) - $start ))
|
30
30
|
}
|
31
31
|
|
32
32
|
t_begin "kill server" && kill $rainbows_pid
|
33
33
|
|
34
34
|
t_begin "got $nr_client responses" && {
|
35
|
-
test $nr_client -eq $(
|
35
|
+
test $nr_client -eq $(count_lines < $curl_out)
|
36
36
|
}
|
37
37
|
|
38
38
|
t_begin "all responses identical" && {
|
39
|
-
test 1 -eq $(sort < $curl_out | uniq |
|
39
|
+
test 1 -eq $(sort < $curl_out | uniq | count_lines)
|
40
40
|
}
|
41
41
|
|
42
42
|
t_begin "sha1 matches on-disk sha1" && {
|