OSDN Git Service

add test scripts
author6638678 <6638678@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Thu, 14 Oct 2010 08:58:50 +0000 (08:58 +0000)
committer6638678 <6638678@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Thu, 14 Oct 2010 08:58:50 +0000 (08:58 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-ramiel-epoll-cond@10372 1ed66053-1c2d-0410-8867-f7571e6e31d3

12 files changed:
test/script/module-protocol-ip/ip-16.sh [new file with mode: 0755]
test/script/module-protocol-ip/ip-18.sh [new file with mode: 0755]
test/script/module-protocol-ip/ip-19.sh [new file with mode: 0755]
test/script/module-protocol-ip/ip-22.sh [new file with mode: 0755]
test/script/module-protocol-ip/ip-24.sh [new file with mode: 0755]
test/script/module-protocol-ip/ip-25.sh [new file with mode: 0755]
test/script/module-protocol-ip/materials/ip-16.pl [new file with mode: 0755]
test/script/module-protocol-ip/materials/ip-18.pl [new file with mode: 0755]
test/script/module-protocol-ip/materials/ip-19.pl [new file with mode: 0755]
test/script/module-protocol-ip/materials/ip-22.pl [new file with mode: 0755]
test/script/module-protocol-ip/materials/ip-24.pl [new file with mode: 0755]
test/script/module-protocol-ip/materials/ip-25.pl [new file with mode: 0755]

diff --git a/test/script/module-protocol-ip/ip-16.sh b/test/script/module-protocol-ip/ip-16.sh
new file mode 100755 (executable)
index 0000000..4a97920
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. ${SET_DEFAULT_CONF}
+
+nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp &
+NC_PID=$!
+
+#Add Service
+$L7VSD
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSD"
+        exit 1
+fi
+
+usleep 100000
+$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for"
+        exit 1
+fi
+
+$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876"
+        exit 1
+fi
+
+#Connect
+
+./materials/ip-16.pl
+wait $NC_PID
+
+echo -e -n "POST / HTTP/1.0\r
+X-Forwarded-For: 127.0.0.1\r
+Content-length: 10\r
+\r
+0123456789" > $TMP_DIR/expect_tmp
+
+if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ]
+then
+        echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp"
+        exit 1
+fi
+
+exit 0
+
diff --git a/test/script/module-protocol-ip/ip-18.sh b/test/script/module-protocol-ip/ip-18.sh
new file mode 100755 (executable)
index 0000000..f553f8c
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+. ${SET_DEFAULT_CONF}
+
+nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp &
+NC_PID=$!
+
+#Add Service
+$L7VSD
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSD"
+        exit 1
+fi
+
+usleep 100000
+$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for"
+        exit 1
+fi
+
+$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876"
+        exit 1
+fi
+
+#Connect
+
+./materials/ip-18.pl
+wait $NC_PID
+
+echo -e -n "POST / HTTP/1.1\r
+X-Forwarded-For: 127.0.0.1\r
+Host: 127.0.0.1\r
+Content-length: 10\r
+\r
+0123456789" > $TMP_DIR/expect_tmp
+
+if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ]
+then
+        echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp"
+        exit 1
+fi
+
+exit 0
+
diff --git a/test/script/module-protocol-ip/ip-19.sh b/test/script/module-protocol-ip/ip-19.sh
new file mode 100755 (executable)
index 0000000..c296b50
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. ${SET_DEFAULT_CONF}
+
+nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp &
+NC_PID=$!
+
+#Add Service
+$L7VSD
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSD"
+        exit 1
+fi
+
+usleep 100000
+$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for"
+        exit 1
+fi
+
+$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876"
+        exit 1
+fi
+
+#Connect
+
+./materials/ip-19.pl
+wait $NC_PID
+
+echo -e -n "GET / HTTP/1.0\r
+X-Forwarded-For: 127.0.0.1\r
+\r\n" > $TMP_DIR/expect_tmp
+
+if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ]
+then
+        echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp"
+        exit 1
+fi
+
+exit 0
+
diff --git a/test/script/module-protocol-ip/ip-22.sh b/test/script/module-protocol-ip/ip-22.sh
new file mode 100755 (executable)
index 0000000..4dd2cc8
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. ${SET_DEFAULT_CONF}
+
+nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp &
+NC_PID=$!
+
+#Add Service
+$L7VSD
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSD"
+        exit 1
+fi
+
+usleep 100000
+$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for"
+        exit 1
+fi
+
+$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876"
+        exit 1
+fi
+
+#Connect
+
+./materials/ip-22.pl
+wait $NC_PID
+
+echo -e -n "POST / HTTP/1.0\r
+Content-length: 10\r
+X-Forwarded-For: proxy1,proxy2, 127.0.0.1\r
+\r
+0123456789" > $TMP_DIR/expect_tmp
+
+if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ]
+then
+        echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp"
+        exit 1
+fi
+
+exit 0
+
diff --git a/test/script/module-protocol-ip/ip-24.sh b/test/script/module-protocol-ip/ip-24.sh
new file mode 100755 (executable)
index 0000000..652eee2
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+. ${SET_DEFAULT_CONF}
+
+nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp &
+NC_PID=$!
+
+#Add Service
+$L7VSD
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSD"
+        exit 1
+fi
+
+usleep 100000
+$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for"
+        exit 1
+fi
+
+$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876"
+        exit 1
+fi
+
+#Connect
+
+./materials/ip-24.pl
+wait $NC_PID
+
+echo -e -n "POST / HTTP/1.1\r
+Host: 127.0.0.1\r
+Content-length: 10\r
+X-Forwarded-For: proxy1,proxy2, 127.0.0.1\r
+\r
+0123456789" > $TMP_DIR/expect_tmp
+
+if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ]
+then
+        echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp"
+        exit 1
+fi
+
+exit 0
+
diff --git a/test/script/module-protocol-ip/ip-25.sh b/test/script/module-protocol-ip/ip-25.sh
new file mode 100755 (executable)
index 0000000..0374d36
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+. ${SET_DEFAULT_CONF}
+
+nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp &
+NC_PID=$!
+
+#Add Service
+$L7VSD
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSD"
+        exit 1
+fi
+
+usleep 100000
+$L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip --forwarded-for"
+        exit 1
+fi
+
+$L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r 127.0.0.1:9876"
+        exit 1
+fi
+
+#Connect
+
+./materials/ip-25.pl
+wait $NC_PID
+
+echo -e -n "GET / HTTP/1.0\r
+X-Forwarded-For: proxy1,proxy2, 127.0.0.1\r\n\r\n" > $TMP_DIR/expect_tmp
+
+if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp`" ]
+then
+        echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/expect_tmp"
+        exit 1
+fi
+
+exit 0
+
diff --git a/test/script/module-protocol-ip/materials/ip-16.pl b/test/script/module-protocol-ip/materials/ip-16.pl
new file mode 100755 (executable)
index 0000000..3628682
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use IO::Socket::INET;
+
+$| = 1;
+
+my $socket = IO::Socket::INET->new(
+       PeerAddr => "127.0.0.1:40001"
+);
+
+print $socket "POST / HTTP/1.0\r\nContent-length: 10\r\n\r\n";
+print $socket "0123456789";
+
+while (<$socket>) {
+       print STDOUT $_;
+}
+
+
diff --git a/test/script/module-protocol-ip/materials/ip-18.pl b/test/script/module-protocol-ip/materials/ip-18.pl
new file mode 100755 (executable)
index 0000000..c09df7f
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use IO::Socket::INET;
+
+$| = 1;
+
+my $socket = IO::Socket::INET->new(
+       PeerAddr => "127.0.0.1:40001"
+);
+
+print $socket "POST / HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-length: 10\r\n\r\n";
+print $socket "0123456789";
+
+while (<$socket>) {
+       print STDOUT $_;
+}
+
+
diff --git a/test/script/module-protocol-ip/materials/ip-19.pl b/test/script/module-protocol-ip/materials/ip-19.pl
new file mode 100755 (executable)
index 0000000..09164c3
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use IO::Socket::INET;
+
+$| = 1;
+
+my $socket = IO::Socket::INET->new(
+       PeerAddr => "127.0.0.1:40001"
+);
+
+print $socket "GET / HT";
+print $socket "TP/1.0\r\n\r\n";
+
+while (<$socket>) {
+       print STDOUT $_;
+}
+
+
diff --git a/test/script/module-protocol-ip/materials/ip-22.pl b/test/script/module-protocol-ip/materials/ip-22.pl
new file mode 100755 (executable)
index 0000000..29e11f6
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use IO::Socket::INET;
+
+$| = 1;
+
+my $socket = IO::Socket::INET->new(
+       PeerAddr => "127.0.0.1:40001"
+);
+
+print $socket "POST / HTTP/1.0\r\nContent-length: 10\r\nX-Forwarded-For: proxy1,proxy2\r\n\r\n";
+print $socket "0123456789";
+
+while (<$socket>) {
+       print STDOUT $_;
+}
+
+
diff --git a/test/script/module-protocol-ip/materials/ip-24.pl b/test/script/module-protocol-ip/materials/ip-24.pl
new file mode 100755 (executable)
index 0000000..096f751
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use IO::Socket::INET;
+
+$| = 1;
+
+my $socket = IO::Socket::INET->new(
+       PeerAddr => "127.0.0.1:40001"
+);
+
+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";
+print $socket "0123456789";
+
+while (<$socket>) {
+       print STDOUT $_;
+}
+
+
diff --git a/test/script/module-protocol-ip/materials/ip-25.pl b/test/script/module-protocol-ip/materials/ip-25.pl
new file mode 100755 (executable)
index 0000000..04dc67d
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use IO::Socket::INET;
+
+$| = 1;
+
+my $socket = IO::Socket::INET->new(
+       PeerAddr => "127.0.0.1:40001"
+);
+
+print $socket "GET / HTTP/1.0\r\nX-Forwar";
+print $socket "ded-For: proxy1,proxy2\r\n\r\n";
+
+while (<$socket>) {
+       print STDOUT $_;
+}
+
+