OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / module-protocol-sslid / sslid-8.sh
1 #!/bin/bash
2
3 . ${SET_DEFAULT_CONF}
4
5 # start l7vsd
6 start_l7vsd || exit 1
7
8 $L7VSADM -A -t 127.0.0.1:44431 -m sslid
9 if [ $? -ne 0 ]
10 then
11         echo "Test failed: $L7VSADM -A -t 127.0.0.1:44431 -m sslid"
12         exit 1
13 fi
14
15 $L7VSADM -a -t 127.0.0.1:44431 -m sslid -r 127.0.0.1:20000
16 if [ $? -ne 0 ]
17 then
18         echo "Test failed: $L7VSADM -a -t 127.0.0.1:44431 -m sslid -r 127.0.0.1:20000"
19         exit 1
20 fi
21
22 PATH=$PATH:$COMMON_SCRIPT_DIR
23
24 # temp file
25 send_bin="/tmp/`uuidgen`.bin"
26 recv_hex="/tmp/`uuidgen`.hex"
27
28 cleanup() {
29         killall hex_echo_server
30         rm $send_bin
31         rm $recv_hex
32 }
33
34 # hex echo server
35 hex_echo_server -p 20000 &
36
37 # convert hex to binary
38 cat materials/sslid-8-data.txt | hex2bin > $send_bin
39 ls -l $send_bin
40
41 # send request
42 test_client2 -p 44431 -s 1 $send_bin > $recv_hex
43
44 send_data=`perl -pe "s/\W//g" materials/sslid-8-data.txt`
45 recv_data=`perl -pe "s/\W//g" $recv_hex`
46
47 cleanup
48
49 if [ "$send_data" != "$recv_data" ]; then
50         echo "Test failed: send and recv data are not matched."
51         exit 1
52 fi
53
54 exit 0
55