Skip to content

Commit fa6421b

Browse files
author
Andras Fekete
committed
Add a sanity check to make sure we can connect to external servers
1 parent dff54af commit fa6421b

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

scripts/test-sanity.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# This script provides simple sanity checks to make sure the provider is working
3+
4+
SET_PRE=$( set )
5+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
6+
LOG_FILE=${SCRIPT_DIR}/test-sanity.log
7+
rm -f ${LOG_FILE}
8+
source ${SCRIPT_DIR}/utils-wolfprovider.sh
9+
10+
echo "Using openssl: $OPENSSL_TAG, wolfssl: $WOLFSSL_TAG"
11+
12+
function doTestCmd() {
13+
CMD=$*
14+
echo ">>>>>> Running $CMD"
15+
eval $CMD
16+
RET=$?
17+
if [ $RET -ne 0 ]; then
18+
echo "Failed $CMD: $RET"
19+
exit 1
20+
fi
21+
echo "<<<<<<"
22+
}
23+
24+
doTestCmd init_wolfprov
25+
26+
SET_POST=$( set )
27+
echo "New variables set:"
28+
diff <(echo "$SET_PRE") <(echo "$SET_POST") | grep "="
29+
30+
doTestCmd "${OPENSSL_INSTALL_DIR}/bin/openssl list -providers --verbose | grep 'Providers:' -A 10"
31+
32+
if [ $(${OPENSSL_INSTALL_DIR}/bin/openssl list -providers --verbose | grep libwolfprov | wc -l) = 0 ]; then
33+
echo "Not using wolfProvider for some reason"
34+
exit 2
35+
fi
36+
37+
if [ $(${OPENSSL_INSTALL_DIR}/bin/openssl list -providers --verbose | grep OpenSSL | wc -l) -ne 0 ]; then
38+
echo "OpenSSL provider is also enabled"
39+
exit 2
40+
fi
41+
42+
doTestCmd "${OPENSSL_INSTALL_DIR}/bin/openssl s_client -CApath /etc/ssl/certs -connect github.com:443 </dev/null"
43+
doTestCmd "curl https://github.com/wolfSSL/wolfProvider -o test.html"
44+
45+
doTestCmd "${OPENSSL_INSTALL_DIR}/bin/openssl s_client -CApath /etc/ssl/certs -connect tcp.support:443 </dev/null"
46+
doTestCmd "curl https://tls.support -vv --tlsv1.3 --tls-max 1.3 -o test.html"
47+
48+
exit $?

0 commit comments

Comments
 (0)