修訂 | 824deab31c790cc7ffaa03b1c0f9fb66ab24ca70 (tree) |
---|---|
時間 | 2010-10-14 17:58:50 |
作者 | 6638678 <6638678@1ed6...> |
Commiter | 6638678 |
add test scripts
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-ramiel-epoll-cond@10372 1ed66053-1c2d-0410-8867-f7571e6e31d3
@@ -0,0 +1,49 @@ | ||
1 | +#!/bin/bash | |
2 | + | |
3 | +. ${SET_DEFAULT_CONF} | |
4 | + | |
5 | +nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp & | |
6 | +NC_PID=$! | |
7 | + | |
8 | +#Add Service | |
9 | +$L7VSD | |
10 | +if [ $? -ne 0 ] | |
11 | +then | |
12 | + echo "Test failed: $L7VSD" | |
13 | + exit 1 | |
14 | +fi | |
15 | + | |
16 | +usleep 100000 | |
17 | +$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for | |
18 | +if [ $? -ne 0 ] | |
19 | +then | |
20 | + echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for" | |
21 | + exit 1 | |
22 | +fi | |
23 | + | |
24 | +$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876 | |
25 | +if [ $? -ne 0 ] | |
26 | +then | |
27 | + echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876" | |
28 | + exit 1 | |
29 | +fi | |
30 | + | |
31 | +#Connect | |
32 | + | |
33 | +./materials/ip-16.pl | |
34 | +wait $NC_PID | |
35 | + | |
36 | +echo -e -n "POST / HTTP/1.0\r | |
37 | +X-Forwarded-For: 127.0.0.1\r | |
38 | +Content-length: 10\r | |
39 | +\r | |
40 | +0123456789" > $TMP_DIR/expect_tmp | |
41 | + | |
42 | +if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ] | |
43 | +then | |
44 | + echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp" | |
45 | + exit 1 | |
46 | +fi | |
47 | + | |
48 | +exit 0 | |
49 | + |
@@ -0,0 +1,50 @@ | ||
1 | +#!/bin/bash | |
2 | + | |
3 | +. ${SET_DEFAULT_CONF} | |
4 | + | |
5 | +nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp & | |
6 | +NC_PID=$! | |
7 | + | |
8 | +#Add Service | |
9 | +$L7VSD | |
10 | +if [ $? -ne 0 ] | |
11 | +then | |
12 | + echo "Test failed: $L7VSD" | |
13 | + exit 1 | |
14 | +fi | |
15 | + | |
16 | +usleep 100000 | |
17 | +$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for | |
18 | +if [ $? -ne 0 ] | |
19 | +then | |
20 | + echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for" | |
21 | + exit 1 | |
22 | +fi | |
23 | + | |
24 | +$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876 | |
25 | +if [ $? -ne 0 ] | |
26 | +then | |
27 | + echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876" | |
28 | + exit 1 | |
29 | +fi | |
30 | + | |
31 | +#Connect | |
32 | + | |
33 | +./materials/ip-18.pl | |
34 | +wait $NC_PID | |
35 | + | |
36 | +echo -e -n "POST / HTTP/1.1\r | |
37 | +X-Forwarded-For: 127.0.0.1\r | |
38 | +Host: 127.0.0.1\r | |
39 | +Content-length: 10\r | |
40 | +\r | |
41 | +0123456789" > $TMP_DIR/expect_tmp | |
42 | + | |
43 | +if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ] | |
44 | +then | |
45 | + echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp" | |
46 | + exit 1 | |
47 | +fi | |
48 | + | |
49 | +exit 0 | |
50 | + |
@@ -0,0 +1,47 @@ | ||
1 | +#!/bin/bash | |
2 | + | |
3 | +. ${SET_DEFAULT_CONF} | |
4 | + | |
5 | +nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp & | |
6 | +NC_PID=$! | |
7 | + | |
8 | +#Add Service | |
9 | +$L7VSD | |
10 | +if [ $? -ne 0 ] | |
11 | +then | |
12 | + echo "Test failed: $L7VSD" | |
13 | + exit 1 | |
14 | +fi | |
15 | + | |
16 | +usleep 100000 | |
17 | +$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for | |
18 | +if [ $? -ne 0 ] | |
19 | +then | |
20 | + echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for" | |
21 | + exit 1 | |
22 | +fi | |
23 | + | |
24 | +$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876 | |
25 | +if [ $? -ne 0 ] | |
26 | +then | |
27 | + echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876" | |
28 | + exit 1 | |
29 | +fi | |
30 | + | |
31 | +#Connect | |
32 | + | |
33 | +./materials/ip-19.pl | |
34 | +wait $NC_PID | |
35 | + | |
36 | +echo -e -n "GET / HTTP/1.0\r | |
37 | +X-Forwarded-For: 127.0.0.1\r | |
38 | +\r\n" > $TMP_DIR/expect_tmp | |
39 | + | |
40 | +if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ] | |
41 | +then | |
42 | + echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp" | |
43 | + exit 1 | |
44 | +fi | |
45 | + | |
46 | +exit 0 | |
47 | + |
@@ -0,0 +1,49 @@ | ||
1 | +#!/bin/bash | |
2 | + | |
3 | +. ${SET_DEFAULT_CONF} | |
4 | + | |
5 | +nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp & | |
6 | +NC_PID=$! | |
7 | + | |
8 | +#Add Service | |
9 | +$L7VSD | |
10 | +if [ $? -ne 0 ] | |
11 | +then | |
12 | + echo "Test failed: $L7VSD" | |
13 | + exit 1 | |
14 | +fi | |
15 | + | |
16 | +usleep 100000 | |
17 | +$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for | |
18 | +if [ $? -ne 0 ] | |
19 | +then | |
20 | + echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for" | |
21 | + exit 1 | |
22 | +fi | |
23 | + | |
24 | +$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876 | |
25 | +if [ $? -ne 0 ] | |
26 | +then | |
27 | + echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876" | |
28 | + exit 1 | |
29 | +fi | |
30 | + | |
31 | +#Connect | |
32 | + | |
33 | +./materials/ip-22.pl | |
34 | +wait $NC_PID | |
35 | + | |
36 | +echo -e -n "POST / HTTP/1.0\r | |
37 | +Content-length: 10\r | |
38 | +X-Forwarded-For: proxy1,proxy2, 127.0.0.1\r | |
39 | +\r | |
40 | +0123456789" > $TMP_DIR/expect_tmp | |
41 | + | |
42 | +if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ] | |
43 | +then | |
44 | + echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp" | |
45 | + exit 1 | |
46 | +fi | |
47 | + | |
48 | +exit 0 | |
49 | + |
@@ -0,0 +1,50 @@ | ||
1 | +#!/bin/bash | |
2 | + | |
3 | +. ${SET_DEFAULT_CONF} | |
4 | + | |
5 | +nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp & | |
6 | +NC_PID=$! | |
7 | + | |
8 | +#Add Service | |
9 | +$L7VSD | |
10 | +if [ $? -ne 0 ] | |
11 | +then | |
12 | + echo "Test failed: $L7VSD" | |
13 | + exit 1 | |
14 | +fi | |
15 | + | |
16 | +usleep 100000 | |
17 | +$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for | |
18 | +if [ $? -ne 0 ] | |
19 | +then | |
20 | + echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for" | |
21 | + exit 1 | |
22 | +fi | |
23 | + | |
24 | +$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876 | |
25 | +if [ $? -ne 0 ] | |
26 | +then | |
27 | + echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876" | |
28 | + exit 1 | |
29 | +fi | |
30 | + | |
31 | +#Connect | |
32 | + | |
33 | +./materials/ip-24.pl | |
34 | +wait $NC_PID | |
35 | + | |
36 | +echo -e -n "POST / HTTP/1.1\r | |
37 | +Host: 127.0.0.1\r | |
38 | +Content-length: 10\r | |
39 | +X-Forwarded-For: proxy1,proxy2, 127.0.0.1\r | |
40 | +\r | |
41 | +0123456789" > $TMP_DIR/expect_tmp | |
42 | + | |
43 | +if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ] | |
44 | +then | |
45 | + echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp" | |
46 | + exit 1 | |
47 | +fi | |
48 | + | |
49 | +exit 0 | |
50 | + |
@@ -0,0 +1,46 @@ | ||
1 | +#!/bin/bash | |
2 | + | |
3 | +. ${SET_DEFAULT_CONF} | |
4 | + | |
5 | +nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp & | |
6 | +NC_PID=$! | |
7 | + | |
8 | +#Add Service | |
9 | +$L7VSD | |
10 | +if [ $? -ne 0 ] | |
11 | +then | |
12 | + echo "Test failed: $L7VSD" | |
13 | + exit 1 | |
14 | +fi | |
15 | + | |
16 | +usleep 100000 | |
17 | +$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for | |
18 | +if [ $? -ne 0 ] | |
19 | +then | |
20 | + echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for" | |
21 | + exit 1 | |
22 | +fi | |
23 | + | |
24 | +$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876 | |
25 | +if [ $? -ne 0 ] | |
26 | +then | |
27 | + echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876" | |
28 | + exit 1 | |
29 | +fi | |
30 | + | |
31 | +#Connect | |
32 | + | |
33 | +./materials/ip-25.pl | |
34 | +wait $NC_PID | |
35 | + | |
36 | +echo -e -n "GET / HTTP/1.0\r | |
37 | +X-Forwarded-For: proxy1,proxy2, 127.0.0.1\r\n\r\n" > $TMP_DIR/expect_tmp | |
38 | + | |
39 | +if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ] | |
40 | +then | |
41 | + echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp" | |
42 | + exit 1 | |
43 | +fi | |
44 | + | |
45 | +exit 0 | |
46 | + |
@@ -0,0 +1,20 @@ | ||
1 | +#!/usr/bin/perl | |
2 | + | |
3 | +use strict; | |
4 | +use warnings; | |
5 | +use IO::Socket::INET; | |
6 | + | |
7 | +$| = 1; | |
8 | + | |
9 | +my $socket = IO::Socket::INET->new( | |
10 | + PeerAddr => "127.0.0.1:40001" | |
11 | +); | |
12 | + | |
13 | +print $socket "POST / HTTP/1.0\r\nContent-length: 10\r\n\r\n"; | |
14 | +print $socket "0123456789"; | |
15 | + | |
16 | +while (<$socket>) { | |
17 | + print STDOUT $_; | |
18 | +} | |
19 | + | |
20 | + |
@@ -0,0 +1,20 @@ | ||
1 | +#!/usr/bin/perl | |
2 | + | |
3 | +use strict; | |
4 | +use warnings; | |
5 | +use IO::Socket::INET; | |
6 | + | |
7 | +$| = 1; | |
8 | + | |
9 | +my $socket = IO::Socket::INET->new( | |
10 | + PeerAddr => "127.0.0.1:40001" | |
11 | +); | |
12 | + | |
13 | +print $socket "POST / HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-length: 10\r\n\r\n"; | |
14 | +print $socket "0123456789"; | |
15 | + | |
16 | +while (<$socket>) { | |
17 | + print STDOUT $_; | |
18 | +} | |
19 | + | |
20 | + |
@@ -0,0 +1,20 @@ | ||
1 | +#!/usr/bin/perl | |
2 | + | |
3 | +use strict; | |
4 | +use warnings; | |
5 | +use IO::Socket::INET; | |
6 | + | |
7 | +$| = 1; | |
8 | + | |
9 | +my $socket = IO::Socket::INET->new( | |
10 | + PeerAddr => "127.0.0.1:40001" | |
11 | +); | |
12 | + | |
13 | +print $socket "GET / HT"; | |
14 | +print $socket "TP/1.0\r\n\r\n"; | |
15 | + | |
16 | +while (<$socket>) { | |
17 | + print STDOUT $_; | |
18 | +} | |
19 | + | |
20 | + |
@@ -0,0 +1,20 @@ | ||
1 | +#!/usr/bin/perl | |
2 | + | |
3 | +use strict; | |
4 | +use warnings; | |
5 | +use IO::Socket::INET; | |
6 | + | |
7 | +$| = 1; | |
8 | + | |
9 | +my $socket = IO::Socket::INET->new( | |
10 | + PeerAddr => "127.0.0.1:40001" | |
11 | +); | |
12 | + | |
13 | +print $socket "POST / HTTP/1.0\r\nContent-length: 10\r\nX-Forwarded-For: proxy1,proxy2\r\n\r\n"; | |
14 | +print $socket "0123456789"; | |
15 | + | |
16 | +while (<$socket>) { | |
17 | + print STDOUT $_; | |
18 | +} | |
19 | + | |
20 | + |
@@ -0,0 +1,20 @@ | ||
1 | +#!/usr/bin/perl | |
2 | + | |
3 | +use strict; | |
4 | +use warnings; | |
5 | +use IO::Socket::INET; | |
6 | + | |
7 | +$| = 1; | |
8 | + | |
9 | +my $socket = IO::Socket::INET->new( | |
10 | + PeerAddr => "127.0.0.1:40001" | |
11 | +); | |
12 | + | |
13 | +print $socket "POST / HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-length: 10\r\nX-Forwarded-For: proxy1,proxy2\r\n\r\n"; | |
14 | +print $socket "0123456789"; | |
15 | + | |
16 | +while (<$socket>) { | |
17 | + print STDOUT $_; | |
18 | +} | |
19 | + | |
20 | + |
@@ -0,0 +1,20 @@ | ||
1 | +#!/usr/bin/perl | |
2 | + | |
3 | +use strict; | |
4 | +use warnings; | |
5 | +use IO::Socket::INET; | |
6 | + | |
7 | +$| = 1; | |
8 | + | |
9 | +my $socket = IO::Socket::INET->new( | |
10 | + PeerAddr => "127.0.0.1:40001" | |
11 | +); | |
12 | + | |
13 | +print $socket "GET / HTTP/1.0\r\nX-Forwar"; | |
14 | +print $socket "ded-For: proxy1,proxy2\r\n\r\n"; | |
15 | + | |
16 | +while (<$socket>) { | |
17 | + print STDOUT $_; | |
18 | +} | |
19 | + | |
20 | + |