Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to skip all tests requiring an internet connection #7945

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions scripts/external.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,35 @@ if ! ./examples/client/client -V | grep -q 3; then
exit 77
fi

# These tests do not run by default, we will call these opt in. There are
# additional default tests that require network connection, those are
# opt out.
# Not defining WOLFSSL_EXTERNAL_TEST runs only opt out.
# Defining WOLFSSL_EXTERNAL_TEST!=0 runs opt out and opt in.
# Defining WOLFSSL_EXTERNAL_TEST=0 does not run opt in or opt out.
if ! test -n "$WOLFSSL_EXTERNAL_TEST"; then
echo "WOLFSSL_EXTERNAL_TEST not set, won't run"
exit 77
fi
if test "$WOLFSSL_EXTERNAL_TEST" == "0"; then
echo "WOLFSSL_EXTERNAL_TEST is defined to zero, won't run"
exit 77
fi

# cloudflare seems to change CAs quickly, disabled by default
if test -n "$WOLFSSL_EXTERNAL_TEST"; then

BUILD_FLAGS="$(./examples/client/client '-#')"
if echo "$BUILD_FLAGS" | fgrep -q -e ' -DWOLFSSL_SNIFFER '; then
echo 'skipping WOLFSSL_EXTERNAL_TEST because -DWOLFSSL_SNIFFER configuration of build is incompatible.'
exit 77
fi

if echo "$BUILD_FLAGS" | fgrep -v -q -e ' -DHAVE_ECC '; then
echo 'skipping WOLFSSL_EXTERNAL_TEST because -UHAVE_ECC configuration of build is incompatible.'
exit 77
fi

echo "WOLFSSL_EXTERNAL_TEST set, running test..."
else
echo "WOLFSSL_EXTERNAL_TEST NOT set, won't run"
BUILD_FLAGS="$(./examples/client/client '-#')"
if echo "$BUILD_FLAGS" | fgrep -q -e ' -DWOLFSSL_SNIFFER '; then
echo 'skipping WOLFSSL_EXTERNAL_TEST because -DWOLFSSL_SNIFFER configuration of build is incompatible.'
exit 77
fi

if echo "$BUILD_FLAGS" | fgrep -v -q -e ' -DHAVE_ECC '; then
echo 'skipping WOLFSSL_EXTERNAL_TEST because -UHAVE_ECC configuration of build is incompatible.'
exit 77
fi

echo "WOLFSSL_EXTERNAL_TEST set, running test..."

# is our desired server there?
"${SCRIPT_DIR}"/ping.test $server 2
RESULT=$?
Expand Down
10 changes: 10 additions & 0 deletions scripts/google.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ server=www.google.com

[ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1

# These tests do not run by default, we will call these opt in. There are
# additional default tests that require network connection, those are
# opt out.
# Not defining WOLFSSL_EXTERNAL_TEST runs only opt out.
# Defining WOLFSSL_EXTERNAL_TEST!=0 runs opt out and opt in.
# Defining WOLFSSL_EXTERNAL_TEST=0 does not run opt in or opt out.
if ! test -n "$WOLFSSL_EXTERNAL_TEST"; then
echo "WOLFSSL_EXTERNAL_TEST not set, won't run"
exit 77
fi
if test "$WOLFSSL_EXTERNAL_TEST" == "0"; then
echo "WOLFSSL_EXTERNAL_TEST is defined to zero, won't run"
exit 77
fi

if ! ./examples/client/client -V | grep -q 3; then
echo 'skipping google.test because TLS1.2 is not available.' 1>&2
Expand Down
12 changes: 12 additions & 0 deletions scripts/ocsp-stapling.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ if [[ -z "${RETRIES_REMAINING-}" ]]; then
export RETRIES_REMAINING=2
fi

# These tests do run by default, we will call these opt out. There are
# additional non-default tests that require network connection, those are
# opt in.
# Not defining WOLFSSL_EXTERNAL_TEST runs only opt out.
# Defining WOLFSSL_EXTERNAL_TEST!=0 runs opt out and opt in.
# Defining WOLFSSL_EXTERNAL_TEST=0 does not run opt in or opt out.
if test "$WOLFSSL_EXTERNAL_TEST" == "0"; then
echo 'skipping oscp-stapling.test because WOLFSSL_EXTERNAL_TEST is \
defined to the value 0.'
exit 77
fi

if ! ./examples/client/client -V | grep -q 3; then
echo 'skipping ocsp-stapling.test because TLS1.2 is not available.' 1>&2
exit 77
Expand Down