1 | #!/bin/bash
|
---|
2 |
|
---|
3 | set -euxo pipefail
|
---|
4 |
|
---|
5 | CURLRC=~/testcase_curlrc
|
---|
6 |
|
---|
7 | # Set up the routing needed for the simulation
|
---|
8 | /setup.sh
|
---|
9 |
|
---|
10 | # The following variables are available for use:
|
---|
11 | # - ROLE contains the role of this execution context, client or server
|
---|
12 | # - SERVER_PARAMS contains user-supplied command line parameters
|
---|
13 | # - CLIENT_PARAMS contains user-supplied command line parameters
|
---|
14 |
|
---|
15 | generate_outputs_http3() {
|
---|
16 | for i in $REQUESTS
|
---|
17 | do
|
---|
18 | OUTFILE=$(basename $i)
|
---|
19 | echo -e "--http3-only\n-o /downloads/$OUTFILE\n--url $i" >> $CURLRC
|
---|
20 | echo "--next" >> $CURLRC
|
---|
21 | done
|
---|
22 | # Remove the last --next
|
---|
23 | head -n -1 $CURLRC > $CURLRC.tmp
|
---|
24 | mv $CURLRC.tmp $CURLRC
|
---|
25 | }
|
---|
26 |
|
---|
27 | dump_curlrc() {
|
---|
28 | echo "Using curlrc:"
|
---|
29 | cat $CURLRC
|
---|
30 | }
|
---|
31 |
|
---|
32 | if [ "$ROLE" == "client" ]; then
|
---|
33 | # Wait for the simulator to start up.
|
---|
34 | echo "Waiting for simulator"
|
---|
35 | /wait-for-it.sh sim:57832 -s -t 30
|
---|
36 | echo "TESTCASE is $TESTCASE"
|
---|
37 | rm -f $CURLRC
|
---|
38 |
|
---|
39 | case "$TESTCASE" in
|
---|
40 | "http3"|"transfer")
|
---|
41 | echo -e "--verbose\n--parallel" >> $CURLRC
|
---|
42 | generate_outputs_http3
|
---|
43 | dump_curlrc
|
---|
44 | SSL_CERT_FILE=/certs/ca.pem curl --config $CURLRC
|
---|
45 | if [ $? -ne 0 ]
|
---|
46 | then
|
---|
47 | exit 1
|
---|
48 | fi
|
---|
49 | exit 0
|
---|
50 | ;;
|
---|
51 | "handshake")
|
---|
52 | OUTFILE=$(basename $REQUESTS)
|
---|
53 | echo -e "--verbose\n--http3\n-H \"Connection: close\"\n-o /downloads/$OUTFILE\n--url $REQUESTS" >> $CURLRC
|
---|
54 | dump_curlrc
|
---|
55 | SSL_CERT_FILE=/certs/ca.pem curl --config $CURLRC
|
---|
56 | if [ $? -ne 0 ]
|
---|
57 | then
|
---|
58 | exit 1
|
---|
59 | fi
|
---|
60 | exit 0
|
---|
61 | ;;
|
---|
62 | "retry")
|
---|
63 | OUTFILE=$(basename $REQUESTS)
|
---|
64 | SSL_CERT_FILE=/certs/ca.pem curl --verbose --http3 -o /downloads/$OUTFILE $REQUESTS
|
---|
65 | if [ $? -ne 0 ]
|
---|
66 | then
|
---|
67 | exit 1
|
---|
68 | fi
|
---|
69 | exit 0
|
---|
70 | ;;
|
---|
71 | "chacha20")
|
---|
72 | OUTFILE=$(basename $REQUESTS)
|
---|
73 | SSL_CERT_FILE=/certs/ca.pem curl --verbose --tlsv1.3 --tls13-ciphers TLS_CHACHA20_POLY1305_SHA256 --http3 -o /downloads/$OUTFILE $REQUESTS
|
---|
74 | if [ $? -ne 0 ]
|
---|
75 | then
|
---|
76 | exit 1
|
---|
77 | fi
|
---|
78 | exit 0
|
---|
79 | ;;
|
---|
80 | *)
|
---|
81 | echo "UNSUPPORTED TESTCASE $TESTCASE"
|
---|
82 | exit 127
|
---|
83 | ;;
|
---|
84 | esac
|
---|
85 | elif [ "$ROLE" == "server" ]; then
|
---|
86 | echo "UNSUPPORTED"
|
---|
87 | exit 127
|
---|
88 | else
|
---|
89 | echo "Unknown ROLE $ROLE"
|
---|
90 | exit 127
|
---|
91 | fi
|
---|
92 |
|
---|