forked from cloudflare/quiche
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_endpoint.sh
executable file
·130 lines (106 loc) · 3.6 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
#!/bin/bash
set -e
# Set up the routing needed for the simulation
/setup.sh
# 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
QUICHE_DIR=/quiche
WWW_DIR=/www
DOWNLOAD_DIR=/downloads
QUICHE_CLIENT=quiche-client
QUICHE_SERVER=quiche-server
QUICHE_CLIENT_OPT="--no-verify --dump-responses ${DOWNLOAD_DIR} --wire-version 00000001"
# interop container has tso off. need to disable gso as well.
QUICHE_SERVER_OPT_COMMON="--listen [::]:443 --root $WWW_DIR --cert /certs/cert.pem --key /certs/priv.key --disable-gso --disable-pacing"
QUICHE_SERVER_OPT="$QUICHE_SERVER_OPT_COMMON --no-retry "
LOG_DIR=/logs
LOG=$LOG_DIR/log.txt
check_testcase () {
case $1 in
handshake | multiconnect | http3 )
echo "supported"
;;
transfer )
echo "supported"
;;
chacha20 )
if [ "$ROLE" == "client" ]; then
# We don't support selecting a cipher on the client-side.
echo "unsupported"
exit 127
elif [ "$ROLE" == "server" ]; then
echo "supported"
fi
;;
resumption )
echo "supported"
QUICHE_CLIENT_OPT="$QUICHE_CLIENT_OPT --session-file=session.bin"
;;
zerortt )
if [ "$ROLE" == "client" ]; then
echo "supported"
QUICHE_CLIENT_OPT="$QUICHE_CLIENT_OPT --session-file=session.bin --early-data"
elif [ "$ROLE" == "server" ]; then
echo "supported"
QUICHE_SERVER_OPT="$QUICHE_SERVER_OPT --early-data"
fi
;;
retry )
echo "supported"
QUICHE_SERVER_OPT="$QUICHE_SERVER_OPT_COMMON"
;;
*)
echo "unsupported"
exit 127
;;
esac
}
run_quiche_client_tests () {
case $1 in
multiconnect )
for req in $REQUESTS
do
$QUICHE_DIR/$QUICHE_CLIENT $QUICHE_CLIENT_OPT \
$CLIENT_PARAMS $req >> $LOG 2>&1
done
;;
resumption | zerortt )
REQS=($REQUESTS)
# Run first request in 1-RTT to establish session.
FIRST_REQUEST=${REQS[0]}
$QUICHE_DIR/$QUICHE_CLIENT $QUICHE_CLIENT_OPT \
$CLIENT_PARAMS $FIRST_REQUEST >> $LOG 2>&1
# Run remaining requests in resumed connection.
REMAINING_REQUESTS=${REQS[@]:1}
$QUICHE_DIR/$QUICHE_CLIENT $QUICHE_CLIENT_OPT \
$CLIENT_PARAMS $REMAINING_REQUESTS >& $LOG 2>&1
;;
*)
$QUICHE_DIR/$QUICHE_CLIENT $QUICHE_CLIENT_OPT \
$CLIENT_PARAMS $REQUESTS >& $LOG
;;
esac
}
run_quiche_server_tests() {
$QUICHE_DIR/$QUICHE_SERVER $SERVER_PARAMS $QUICHE_SERVER_OPT >& $LOG
}
# Update config based on test case
check_testcase $TESTCASE
# Create quiche log directory
mkdir -p $LOG_DIR
if [ "$ROLE" == "client" ]; then
# Wait for the simulator to start up.
wait-for-it sim:57832 -s -t 30
echo "## Starting quiche client..."
echo "## Client params: $CLIENT_PARAMS"
echo "## Requests: $REQUESTS"
echo "## Test case: $TESTCASE"
run_quiche_client_tests $TESTCASE
elif [ "$ROLE" == "server" ]; then
echo "## Starting quiche server..."
echo "## Server params: $SERVER_PARAMS"
echo "## Test case: $TESTCASE"
run_quiche_server_tests
fi