2
0

dtlscid.test 895 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. set -e
  3. cleanup () {
  4. echo "Cleaning up..."
  5. if [ ! -z "$SERVER_PID" ];then
  6. echo "Killing server $SERVER_PID"
  7. kill $SERVER_PID
  8. fi
  9. }
  10. trap cleanup err exit
  11. CCID="AA"
  12. SCID="BB"
  13. HEXCID=$(printf $CCID | od -An -tx1 | tr -d ' \n')
  14. HEXSCID=$(printf $SCID | od -An -tx1 | tr -d ' \n')
  15. WOLFSSL_ROOT=$(pwd)
  16. SERVER_PORT=11111
  17. (killall lt-server || true)
  18. (killall lt-client || true)
  19. test_cid () {
  20. $WOLFSSL_ROOT/examples/server/server -v4 -u --cid $SCID 2>/tmp/serr 1>/tmp/sout &
  21. SERVER_PID=$!
  22. sleep 0.2
  23. now=$(date +%s.%N)
  24. $WOLFSSL_ROOT/examples/client/client -v4 -u --cid $CCID 2>/tmp/cerr 1>/tmp/cout
  25. elapsed=$(echo $(date +%s.%N) - $now | bc)
  26. echo "it took ${elapsed} sec(s)" >> /tmp/udp
  27. wait $SERVER_PID
  28. SERVER_PID=
  29. grep "Sending CID is ${HEXSCID}" < /tmp/cout
  30. grep "Sending CID is ${HEXCID}" < /tmp/sout
  31. }
  32. test_cid