-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_endpoint.sh
executable file
·150 lines (144 loc) · 5.03 KB
/
run_endpoint.sh
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
#!/bin/bash
# Set up the routing needed for the simulation
echo "Setting up the simulation with setup.sh"
/setup.sh
echo "Setup.sh completed"
# The following variables are available for use:
# - ROLE contains the role of this execution context, client or server
# - SERVER_PARAMS contains user-supplied command line parameters
# - CLIENT_PARAMS contains user-supplied command line parameters
RET=0
# Verify that the test case is supported
case "$TESTCASE" in
"versionnegotiation") RET=0 ;;
"handshake") RET=0 ;;
"transfer") RET=0 ;;
"retry") RET=0 ;;
"resumption") RET=0 ;;
"zerortt") RET=0 ;;
"http3") RET=0 ;;
"multiconnect") RET=0 ;;
"chacha20") RET=0 ;;
"ecn") RET=0;;
"keyupdate") RET=0;;
"v2") RET=0;;
*) echo "Unsupported test case: $TESTCASE"; exit 127 ;;
esac
if [ "$ROLE" == "client" ]; then
# Wait for the simulator to start up.
echo "Waiting for the simulator to start"
/wait-for-it.sh sim:57832 -s -t 30
echo "Starting picoquic client for test: $TESTCASE"
# setup default parameters
LOGFILE="/logs/test_log.txt"
TEST_PARAMS="$CLIENT_PARAMS -8 -L -l $LOGFILE -q /logs/qlog -o /downloads -0 -d 180000"
if [ "$TESTCASE" == "http3" ]; then
TEST_PARAMS="$TEST_PARAMS -a h3";
else
TEST_PARAMS="$TEST_PARAMS -a hq-interop";
fi
if [ "$TESTCASE" == "versionnegotiation" ]; then
TEST_PARAMS="$TEST_PARAMS -v 5a6a7a8a";
else
TEST_PARAMS="$TEST_PARAMS -v 00000001";
fi
if [ "$TESTCASE" == "chacha20" ]; then
TEST_PARAMS="$TEST_PARAMS -C 20";
fi
if [ "$TESTCASE" == "keyupdate" ]; then
TEST_PARAMS="$TEST_PARAMS -u 32";
fi
if [ "$TESTCASE" == "v2" ]; then
TEST_PARAMS="$TEST_PARAMS -U 6b3343cf";
fi
echo "Starting picoquic client ..."
SERVER="server"
if [ ! -z "$REQUESTS" ]; then
# Get the server ID out of the first request
REQS=($REQUESTS)
REQ1=${REQS[0]}
echo "Parsing server name from first request: $REQ1"
SERVER=$(echo $REQ1 | cut -d/ -f3 | cut -d: -f1)
echo "Server set to: $SERVER"
# pull requests out of param
echo "Requests: " $REQUESTS
for REQ in $REQUESTS; do
FILE=`echo $REQ | cut -f4 -d'/'`
echo "parsing <$REQ> as <$FILE>"
FILELIST=${FILELIST}"-:/"${FILE}";"
done
if [ "$TESTCASE" == "resumption" ] ||
[ "$TESTCASE" == "zerortt" ] ; then
FILE1=`echo $FILELIST | cut -f1 -d";"`
FILE2=`echo $FILELIST | cut -f2- -d";"`
L1="/logs/first_log.txt"
L2="/logs/second_log.txt"
echo "File1: $FILE1"
echo "File2: $FILE2"
rm *.bin
echo "/picoquic/picoquicdemo $TEST_PARAMS $SERVER 443 $FILE1"
/picoquic/picoquicdemo $TEST_PARAMS $SERVER 443 $FILE1
if [ $? != 0 ]; then
RET=1
echo "First call to picoquicdemo failed"
else
mv $LOGFILE $L1
echo "/picoquic/picoquicdemo $TEST_PARAMS $SERVER 443 $FILE2"
/picoquic/picoquicdemo $TEST_PARAMS $SERVER 443 $FILE2
if [ $? != 0 ]; then
RET=1
echo "Second call to picoquicdemo failed"
fi
mv $LOGFILE $L2
fi
elif [ "$TESTCASE" == "multiconnect" ]; then
for CREQ in $REQUESTS; do
CFILE=`echo $CREQ | cut -f4 -d'/'`
CFILEX="/$CFILE"
echo "/picoquic/picoquicdemo $TEST_PARAMS $SERVER 443 $CFILEX"
/picoquic/picoquicdemo $TEST_PARAMS $SERVER 443 $CFILEX
if [ $? != 0 ]; then
RET=1
echo "Call to picoquicdemo failed"
fi
MCLOG="/logs/mc-$CFILE.txt"
echo "mv $LOGFILE $MCLOG"
mv $LOGFILE $MCLOG
done
else
if [ "$TESTCASE" == "retry" ]; then
rm *.bin
fi
/picoquic/picoquicdemo $TEST_PARAMS $SERVER 443 $FILELIST
if [ $? != 0 ]; then
RET=1
echo "Call to picoquicdemo failed"
fi
fi
fi
### Server side ###
elif [ "$ROLE" == "server" ]; then
echo "Starting picoquic server for test:" $TESTCASE
TEST_PARAMS="$SERVER_PARAMS -8 -w ./www -L -l /logs/server_log.txt"
TEST_PARAMS="$TEST_PARAMS -q /logs/qlog"
TEST_PARAMS="$TEST_PARAMS -k /certs/priv.key"
TEST_PARAMS="$TEST_PARAMS -c /certs/cert.pem"
TEST_PARAMS="$TEST_PARAMS -p 443 -V -0 -d 180000"
ls /www
case "$TESTCASE" in
"retry") TEST_PARAMS="$TEST_PARAMS -r" ;;
*) ;;
esac
echo "Starting picoquic server ..."
echo "TEST_PARAMS: $TEST_PARAMS"
picoquic/picoquicdemo $TEST_PARAMS
if [ $? != 0 ]; then
RET=1
echo "Could not start picoquicdemo"
fi
cp /var/crash/* /logs
else
echo "Unexpected role: $ROLE"
RET=1
fi
exit $RET