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