From 5f755f6bd5321d71ebfa008ccd9dd59c1d0878d6 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Mon, 9 Feb 2026 18:18:21 +0100 Subject: [PATCH] Fix compilation checks in test scripts Correct the logic for checking if the client and server examples are compiled in the test scripts. The previous logic was inverted, causing the tests to always skip if the examples *were* compiled. --- scripts/benchmark.test | 13 +++++++++++++ scripts/crl-revoked.test | 7 ++++++- scripts/dtls.test | 13 +++++++++++++ scripts/dtlscid.test | 8 ++++---- scripts/ocsp-stapling-with-ca-as-responder.test | 8 ++++---- scripts/ocsp-stapling.test | 8 ++++---- scripts/ocsp-stapling2.test | 8 ++++---- scripts/ocsp-stapling_tls13multi.test | 8 ++++---- scripts/pkcallbacks.test | 7 ++++++- scripts/rsapss.test | 13 +++++++++++++ scripts/trusted_peer.test | 13 +++++++++++++ 11 files changed, 84 insertions(+), 22 deletions(-) diff --git a/scripts/benchmark.test b/scripts/benchmark.test index dc3ba9cec45..b9a7b8ea62e 100755 --- a/scripts/benchmark.test +++ b/scripts/benchmark.test @@ -2,6 +2,19 @@ #benchmark.test +[ ! -x ./examples/client/client ] && printf '\n\n%s\n' "Client doesn't exist" \ + && exit 1 + +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping benchmark.test because client not compiled in.' 1>&2 + exit 77 +fi + +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping benchmark.test because server not compiled in.' 1>&2 + exit 77 +fi + if [ "$#" -lt 2 ]; then echo "Usage: $0 [mode] [num] [clientargs] [serverargs]" >&2 echo " [mode]: 1=Connection Rate (TPS), 2=Throughput Bytes" >&2 diff --git a/scripts/crl-revoked.test b/scripts/crl-revoked.test index 7a9108d0728..95a8d1470e7 100755 --- a/scripts/crl-revoked.test +++ b/scripts/crl-revoked.test @@ -3,11 +3,16 @@ [ ! -x ./examples/client/client ] && printf '\n\n%s\n' "Client doesn't exist" \ && exit 1 -if ! ./examples/client/client | grep "Client not compiled in!" ; then +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then echo 'skipping crl-revoked.test because client not compiled in.' 1>&2 exit 77 fi +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping crl-revoked.test because server not compiled in.' 1>&2 + exit 77 +fi + #crl.test # if we can, isolate the network namespace to eliminate port collisions. if [[ -n "$NETWORK_UNSHARE_HELPER" ]]; then diff --git a/scripts/dtls.test b/scripts/dtls.test index a563db5e08e..1aa0f78c6d2 100755 --- a/scripts/dtls.test +++ b/scripts/dtls.test @@ -16,6 +16,19 @@ DO_DELAY_TEST=${DO_DELAY_TEST:-0} #set -x # enable debug output +[ ! -x ./examples/client/client ] && printf '\n\n%s\n' "Client doesn't exist" \ + && exit 1 + +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping dtls.test because client not compiled in.' 1>&2 + exit 77 +fi + +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping dtls.test because server not compiled in.' 1>&2 + exit 77 +fi + # bwrap execution environment to avoid port conflicts if [ "${AM_BWRAPPED-}" != "yes" ]; then bwrap_path="$(command -v bwrap)" diff --git a/scripts/dtlscid.test b/scripts/dtlscid.test index 52f2fe51239..58968d978dd 100755 --- a/scripts/dtlscid.test +++ b/scripts/dtlscid.test @@ -9,13 +9,13 @@ [ ! -x ./examples/server/server ] && printf '\n\n%s\n' "Server doesn't exist" \ && exit 0 -if ! ./examples/client/client | grep "Client not compiled in!" ; then - echo 'skipping crl-revoked.test because client not compiled in.' 1>&2 +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping dtlscid.test because client not compiled in.' 1>&2 exit 77 fi -if ! ./examples/server/server | grep "Server not compiled in!" ; then - echo 'skipping crl-revoked.test because server not compiled in.' 1>&2 +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping dtlscid.test because server not compiled in.' 1>&2 exit 77 fi diff --git a/scripts/ocsp-stapling-with-ca-as-responder.test b/scripts/ocsp-stapling-with-ca-as-responder.test index 22a34cfe668..74fd02e1966 100755 --- a/scripts/ocsp-stapling-with-ca-as-responder.test +++ b/scripts/ocsp-stapling-with-ca-as-responder.test @@ -29,13 +29,13 @@ fi [ ! -x ./examples/server/server ] && printf '\n\n%s\n' "Server doesn't exist" \ && exit 1 -if ! ./examples/client/client | grep "Client not compiled in!" ; then - echo 'skipping crl-revoked.test because client not compiled in.' 1>&2 +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping ocsp-stapling-with-ca-as-responder.test because client not compiled in.' 1>&2 exit 77 fi -if ! ./examples/server/server | grep "Server not compiled in!" ; then - echo 'skipping crl-revoked.test because server not compiled in.' 1>&2 +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping ocsp-stapling-with-ca-as-responder.test because server not compiled in.' 1>&2 exit 77 fi diff --git a/scripts/ocsp-stapling.test b/scripts/ocsp-stapling.test index bf06bfc03a8..e7598a7e7a9 100755 --- a/scripts/ocsp-stapling.test +++ b/scripts/ocsp-stapling.test @@ -23,13 +23,13 @@ fi [ ! -x ./examples/server/server ] && printf '\n\n%s\n' "Server doesn't exist" \ && exit 1 -if ! ./examples/client/client | grep "Client not compiled in!" ; then - echo 'skipping crl-revoked.test because client not compiled in.' 1>&2 +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping ocsp-stapling.test because client not compiled in.' 1>&2 exit 77 fi -if ! ./examples/server/server | grep "Server not compiled in!" ; then - echo 'skipping crl-revoked.test because server not compiled in.' 1>&2 +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping ocsp-stapling.test because server not compiled in.' 1>&2 exit 77 fi diff --git a/scripts/ocsp-stapling2.test b/scripts/ocsp-stapling2.test index c45431602b1..cbfdb2e68d8 100755 --- a/scripts/ocsp-stapling2.test +++ b/scripts/ocsp-stapling2.test @@ -30,13 +30,13 @@ fi [ ! -x ./examples/server/server ] && printf '\n\n%s\n' "Server doesn't exist" \ && exit 1 -if ! ./examples/client/client | grep "Client not compiled in!" ; then - echo 'skipping crl-revoked.test because client not compiled in.' 1>&2 +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping ocsp-stapling2.test because client not compiled in.' 1>&2 exit 77 fi -if ! ./examples/server/server | grep "Server not compiled in!" ; then - echo 'skipping crl-revoked.test because server not compiled in.' 1>&2 +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping ocsp-stapling2.test because server not compiled in.' 1>&2 exit 77 fi diff --git a/scripts/ocsp-stapling_tls13multi.test b/scripts/ocsp-stapling_tls13multi.test index 0473b16411a..dbdcb53f7c8 100755 --- a/scripts/ocsp-stapling_tls13multi.test +++ b/scripts/ocsp-stapling_tls13multi.test @@ -30,13 +30,13 @@ fi [ ! -x ./examples/server/server ] && printf '\n\n%s\n' "Server doesn't exist" \ && exit 1 -if ! ./examples/client/client | grep "Client not compiled in!" ; then - echo 'skipping crl-revoked.test because client not compiled in.' 1>&2 +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping ocsp-stapling_tls13multi.test because client not compiled in.' 1>&2 exit 77 fi -if ! ./examples/server/server | grep "Server not compiled in!" ; then - echo 'skipping crl-revoked.test because server not compiled in.' 1>&2 +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping ocsp-stapling_tls13multi.test because server not compiled in.' 1>&2 exit 77 fi diff --git a/scripts/pkcallbacks.test b/scripts/pkcallbacks.test index 8167e5d5dae..0a6fb2d7b52 100755 --- a/scripts/pkcallbacks.test +++ b/scripts/pkcallbacks.test @@ -5,11 +5,16 @@ [ ! -x ./examples/client/client ] && printf '\n\n%s\n' "Client doesn't exist" \ && exit 1 -if ! ./examples/client/client | grep "Client not compiled in!" ; then +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then echo 'skipping pkcallbacks.test because client not compiled in.' 1>&2 exit 77 fi +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping pkcallbacks.test because server not compiled in.' 1>&2 + exit 77 +fi + # if we can, isolate the network namespace to eliminate port collisions. if [[ -n "$NETWORK_UNSHARE_HELPER" ]]; then if [[ -z "$NETWORK_UNSHARE_HELPER_CALLED" ]]; then diff --git a/scripts/rsapss.test b/scripts/rsapss.test index 8a6b857a01c..09f7c394ee6 100755 --- a/scripts/rsapss.test +++ b/scripts/rsapss.test @@ -2,6 +2,19 @@ # rsapss.test +[ ! -x ./examples/client/client ] && printf '\n\n%s\n' "Client doesn't exist" \ + && exit 1 + +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping rsapss.test because client not compiled in.' 1>&2 + exit 77 +fi + +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping rsapss.test because server not compiled in.' 1>&2 + exit 77 +fi + if ! ./examples/client/client -V | grep -q 4; then echo "skipping because TLS 1.3 not enabled in this build" exit 0 diff --git a/scripts/trusted_peer.test b/scripts/trusted_peer.test index cdcca7b25bd..f616a5ee999 100755 --- a/scripts/trusted_peer.test +++ b/scripts/trusted_peer.test @@ -3,6 +3,19 @@ # trusted_peer.test # copyright wolfSSL 2016 +[ ! -x ./examples/client/client ] && printf '\n\n%s\n' "Client doesn't exist" \ + && exit 1 + +if ./examples/client/client -? 2>&1 | grep "Client not compiled in!" ; then + echo 'skipping trusted_peer.test because client not compiled in.' 1>&2 + exit 77 +fi + +if ./examples/server/server -? 2>&1 | grep "Server not compiled in!" ; then + echo 'skipping trusted_peer.test because server not compiled in.' 1>&2 + exit 77 +fi + # if we can, isolate the network namespace to eliminate port collisions. if [[ -n "$NETWORK_UNSHARE_HELPER" ]]; then if [[ -z "$NETWORK_UNSHARE_HELPER_CALLED" ]]; then