Repository navigation
Expand file tree
/
Copy pathtestsplitmode.sh
More file actions
executable file
·181 lines (160 loc) · 4.77 KB
/
Copy pathtestsplitmode.sh
File metadata and controls
executable file
·181 lines (160 loc) · 4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/bash
# set -x
# to pick up correct executables and .so's
: ${CODETOP:="$HOME/code/defo-project-org/openssl"}
: ${EDTOP:="$HOME/code/defo-project-org/ech-dev-utils"}
# where we have/want test files
: ${RUNTOP:=`/bin/pwd`}
export RUNTOP=$RUNTOP
# where back-end web server can be found
: ${LIGHTY:="$HOME/code/defo-project-org/lighttpd1.4"}
# where front-end haproxy can be found
: ${HAPPY:="$HOME/code/defo-project-org/haproxy"}
# where front-end nginx can be found
: ${NTOP:="$HOME/code/defo-project-org/nginx"}
export LD_LIBRARY_PATH=$CODETOP:$LIGHTY/src/.libs
allgood="yes"
. $EDTOP/scripts/funcs.sh
NOW=$(whenisitagain)
# in case we wanna dump core and get a backtrace, make a place for
# that (dir name is also in configs/nginxmin.conf)
mkdir -p /tmp/cores
HLOGDIR="$RUNTOP/haproxy/logs"
HLOGFILE="$HLOGDIR/haproxy.log"
CLILOGFILE=`mktemp`
SRVLOGFILE=`mktemp`
TECH=$1
# some preliminaries - ensure directories exist, kill old servers
prep_server_dirs $TECH
s_server_stop
FE_PIDFILE=$RUNTOP/$TECH/logs/$TECH.pid
# Kill off old processes from the last test
if [ -f $FE_PIDFILE ]
then
echo "Killing old $TECH in process `cat $FE_PIDFILE`"
kill `cat $FE_PIDFILE`
rm -f $FE_PIDFILE
fi
if [[ "$TECH" == "nginx" ]]
then
# nginx specific: if we don't have a local config below RUNTOP, replace
# pathnames in repo version and copy to where it's needed
if [ ! -f $RUNTOP/nginx/nginxsplit.conf ]
then
do_envsubst
fi
# if the repo version of the config is newer, then backup the RUNTOP
# version and re-run envsubst
repo_date=`stat -c %Y $EDTOP/configs/nginxsplit.conf`
runtop_date=`stat -c %Y $RUNTOP/nginx/nginxsplit.conf`
if (( repo_date >= runtop_date))
then
cp $RUNTOP/nginx/nginxsplit.conf $RUNTOP/nginx/nginxsplit.conf.$NOW
do_envsubst
fi
fi
if [[ "$TECH" == "nginx" ]]
then
echo "Executing: $NTOP/objs/nginx -c nginxsplit.conf"
$NTOP/objs/nginx -c nginxsplit.conf
elif [[ "$TECH" == "haproxy" ]]
then
HAPDEBUGSTR=" -DdV"
echo "Executing: $HAPPY/haproxy -f $EDTOP/configs/haproxymin.conf $HAPDEBUGSTR >>$HLOGFILE 2>&1"
$HAPPY/haproxy -f $EDTOP/configs/haproxymin.conf $HAPDEBUGSTR >>$HLOGFILE 2>&1
else
echo "Unknown tech: $TECH -exiting"
exit 77
fi
# start a backend
PIDFILE=$RUNTOP/lighttpd/logs/lighttpd.pid
lighty_start $EDTOP/configs/lighttpdsplit.conf
SKIPEM="no"
if [[ "$SKIPEM" != "yes" ]]
then
# A test where we do split-mode until it fails
# Trun this on manually if needed (when we're debugging
# split-mode if it's not working:-)
JUSTSPLIT="no"
if [[ "$JUSTSPLIT" == "yes" ]]
then
iter=0
while true
do
iter=$((iter+1))
for type in real hrr
do
echo "Doing iter $iter type $type"
cli_test 7446 $type
if [[ "$allgood" != "yes" ]]
then
break
fi
done
if [[ "$allgood" != "yes" ]]
then
break
fi
done
exit 0
fi
# all these should appear the same to the client
# server log checks will tell us if stuff worked or not
echo "Doing split-mode tests..."
for type in real grease public real hrr
do
for port in 7443 7444 7445 7446
do
echo "Testing $type $port"
cli_test $port $type
done
done
fi # end of SKIPEM
# need special stuff for early_data as lighty doesn't support that
echo "Doing early data tests"
# lighttpd doesn't support early data so we need to swap over to
# s_server
lighty_stop
# the backend port that can do split-mode (via lighttpd)
be_port=3484
# we wanna try with and without hitting hrr
for type in nohrr hrr
do
port=7446
echo "Testing $type $port"
s_server_start $type $be_port
sleep 3
# connect twice, 2nd time using resumption and sending early data
session_ticket_file=`mktemp`
rm -f $session_ticket_file
$EDTOP/scripts/echcli.sh -H foo.example.com -s localhost -p $port -P $RUNTOP/echconfig.pem -f index.html -S $session_ticket_file >>$CLILOGFILE 2>&1
if [ ! -f $session_ticket_file ]
then
# s_server_stop
echo "No session, so can't try early data - skipping $type $port"
allgood="no"
break
fi
$EDTOP/scripts/echcli.sh -H foo.example.com -s localhost -p $port -P $RUNTOP/echconfig.pem -f index.html -S $session_ticket_file -e >>$CLILOGFILE 2>&1
rm -f $session_ticket_file
res=$?
if [[ "$res" != "0" ]]
then
echo "Early-data+split-mode test failed (with-HRR: $HRR)"
allgood="no"
fi
s_server_stop
done
if [[ "$allgood" == "yes" ]]
then
echo "All good."
rm -f $CLILOGFILE $SRVLOGFILE
else
echo "Something failed."
mv $CLILOGFILE $RUNTOP/$TECH/logs/cli.log
mv $SRVLOGFILE $RUNTOP/$TECH/logs/srv.log
fi
# Kill off processes from this test
killall $TECH
rm -f $FE_PIDFILE $PIDFILE
s_server_stop