Remove building with NOCRYPTO option
[minix.git] / crypto / external / bsd / openssl / dist / demos / tunala / test.sh
blob105b447333bc10b58cea27d66f83b9ef5cf8bd39
1 #!/bin/sh
3 HTTP="localhost:8080"
4 CLIENT_PORT="9020"
5 SERVER_PORT="9021"
7 sub_test ()
9 echo "STARTING - $VER $CIPHER"
10 ./tunala -listen localhost:$CLIENT_PORT -proxy localhost:$SERVER_PORT \
11 -cacert CA.pem -cert A-client.pem -server 0 \
12 -dh_special standard -v_peer -v_strict \
13 $VER -cipher $CIPHER 1> tc1.txt 2> tc2.txt &
14 ./tunala -listen localhost:$SERVER_PORT -proxy $HTTP \
15 -cacert CA.pem -cert A-server.pem -server 1 \
16 -dh_special standard -v_peer -v_strict \
17 $VER -cipher $CIPHER 1> ts1.txt 2> ts2.txt &
18 # Wait for the servers to be listening before starting the wget test
19 DONE="no"
20 while [ "$DONE" != "yes" ]; do
21 L1=`netstat -a | egrep "LISTEN[\t ]*$" | grep ":$CLIENT_PORT"`
22 L2=`netstat -a | egrep "LISTEN[\t ]*$" | grep ":$SERVER_PORT"`
23 if [ "x$L1" != "x" ]; then
24 DONE="yes"
25 elif [ "x$L2" != "x" ]; then
26 DONE="yes"
27 else
28 sleep 1
30 done
31 HTML=`wget -O - -T 1 http://localhost:$CLIENT_PORT 2> /dev/null | grep "<HTML>"`
32 if [ "x$HTML" != "x" ]; then
33 echo "OK - $CIPHER ($VER)"
34 else
35 echo "FAIL - $CIPHER ($VER)"
36 killall tunala
37 exit 1
39 killall tunala
40 # Wait for the servers to stop before returning - otherwise the next
41 # test my fail to start ... (fscking race conditions)
42 DONE="yes"
43 while [ "$DONE" != "no" ]; do
44 L1=`netstat -a | egrep "LISTEN[\t ]*$" | grep ":$CLIENT_PORT"`
45 L2=`netstat -a | egrep "LISTEN[\t ]*$" | grep ":$SERVER_PORT"`
46 if [ "x$L1" != "x" ]; then
47 DONE="yes"
48 elif [ "x$L2" != "x" ]; then
49 DONE="yes"
50 else
51 DONE="no"
53 done
54 exit 0
57 run_test ()
59 (sub_test 1> /dev/null) || exit 1
62 run_ssl_test ()
64 killall tunala 1> /dev/null 2> /dev/null
65 echo ""
66 echo "Starting all $PRETTY tests"
67 if [ "$PRETTY" != "SSLv2" ]; then
68 if [ "$PRETTY" != "SSLv3" ]; then
69 export VER="-no_ssl2 -no_ssl3"
70 export OSSL="-tls1"
71 else
72 export VER="-no_ssl2 -no_tls1"
73 export OSSL="-ssl3"
75 else
76 export VER="-no_ssl3 -no_tls1"
77 export OSSL="-ssl2"
79 LIST="`../../apps/openssl ciphers $OSSL | sed -e 's/:/ /g'`"
80 #echo "$LIST"
81 for i in $LIST; do \
82 DSS=`echo "$i" | grep "DSS"`
83 if [ "x$DSS" != "x" ]; then
84 echo "---- skipping $i (no DSA cert/keys) ----"
85 else
86 export CIPHER=$i
87 run_test
88 echo "SUCCESS: $i"
90 done;
93 # Welcome the user
94 echo "Tests will assume an http server running at $HTTP"
96 # TLSv1 test
97 export PRETTY="TLSv1"
98 run_ssl_test
100 # SSLv3 test
101 export PRETTY="SSLv3"
102 run_ssl_test
104 # SSLv2 test
105 export PRETTY="SSLv2"
106 run_ssl_test