run_test.sh 775 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. # Run the tests for CA-Certificates Verify if the ca certificates exists for windows platform.
  3. set -ex
  4. exists() {
  5. FULL_PATH="${PREFIX}/${1}"
  6. if [ -f "${FULL_PATH}" ]; then
  7. echo "Found ${1}"
  8. else
  9. echo "Could not find ${FULL_PATH}"
  10. exit 1
  11. fi
  12. }
  13. for i in ssl/{cacert,cert}.pem ; do
  14. exists $i
  15. done
  16. user_cert() {
  17. exit_status=$1
  18. if [ "$exit_status" -eq 0 ]; then
  19. echo "Able to use ca certificate"
  20. else
  21. echo "Failed to use ca cert files"
  22. exit 1
  23. fi
  24. }
  25. #openssl -CAfile "${PREFIX}/ssl/cacert.pem" -CApath nosuchdir s_client -showcerts -connect www.google.com:443
  26. openssl s_client -CAfile "${PREFIX}/ssl/cacert.pem" -showcerts -connect www.google.com:443
  27. user_cert $?
  28. curl --cacert "${PREFIX}/ssl/cacert.pem" https://www.google.com
  29. user_cert $?