Home | History | Annotate | Line # | Download | only in quic-openssl-docker
      1 #!/bin/bash
      2 
      3 CURLRC=~/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 
     13 generate_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 
     25 dump_curlrc() {
     26     echo "Using curlrc:"
     27     cat $CURLRC
     28 }
     29 
     30 if [ "$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"|"ipv6")
     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
     87 elif [ "$ROLE" == "server" ]; then
     88     echo "TESTCASE is $TESTCASE"
     89     rm -f $CURLRC 
     90     case "$TESTCASE" in
     91     "handshake"|"transfer"|"ipv6")
     92         NO_ADDR_VALIDATE=yes SSLKEYLOGFILE=/logs/keys.log FILEPREFIX=/www quic-hq-interop-server 443 /certs/cert.pem /certs/priv.key
     93         ;;
     94     "retry")
     95         SSLKEYLOGFILE=/logs/keys.log FILEPREFIX=/www quic-hq-interop-server 443 /certs/cert.pem /certs/priv.key
     96         ;;
     97     "resumption")
     98         NO_ADDR_VALIDATE=yes SSLKEYLOGFILE=/logs/keys.log FILEPREFIX=/www quic-hq-interop-server 443 /certs/cert.pem /certs/priv.key
     99         ;;
    100     "http3")
    101         FILEPREFIX=/www/ SSLKEYLOGFILE=/logs/keys.log ossl-nghttp3-demo-server 443 /certs/cert.pem /certs/priv.key
    102         ;;
    103     "chacha20")
    104         SSL_CIPHER_SUITES=TLS_CHACHA20_POLY1305_SHA256 SSLKEYLOGFILE=/logs/keys.log FILEPREFIX=/www quic-hq-interop-server 443 /certs/cert.pem /certs/priv.key
    105         ;;
    106     *)
    107         echo "UNSUPPORTED TESTCASE $TESTCASE"
    108         exit 127
    109         ;;
    110     esac
    111 else
    112     echo "Unknown ROLE $ROLE"
    113     exit 127
    114 fi
    115 
    116