run_endpoint.sh 4.0 KB

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