[PATCH] tests: Allow build.sh --force-config to override CONFIG_TLS
Karsten Sperling
ksperling at apple.com
Sun Oct 11 16:16:34 PDT 2026
E.g. `build.sh --force-config=wolfssl` will re-install the example
configs but prepends CONFIG_TLS=wolfssl. The example configs now use
`CONFIG_TLS?=openssl` so the prepended value wins. (The openssl
default in the Makefiles is applied too late for the CONFIG_TLS checks
within the example configs themselves.)
Different backends can be specified for hostapd and wpa_supplicant by
separating them with "/", e.g. `build.sh --force-config=wolfssl/openssl`
will build hostapd with wolfSSL and wpa_supplicant with OpenSSL.
The --force-config argument can also be passed to run-all.sh, and will
be forwarded to build.sh.
Also disable DPP and NAN in the example configs when using wolfSSL,
since that backend doesn't implement the hpke_* and pbkdf2_sha256/384
functions they need.
Signed-off-by: Karsten Sperling <ksperling at apple.com>
---
tests/hwsim/build.sh | 49 +++++++++++++++++++----
tests/hwsim/example-hostapd.config | 9 ++++-
tests/hwsim/example-wpa_supplicant.config | 12 ++++--
tests/hwsim/run-all.sh | 15 ++++++-
4 files changed, 73 insertions(+), 12 deletions(-)
diff --git a/tests/hwsim/build.sh b/tests/hwsim/build.sh
index 1d1493ad0..a10096100 100755
--- a/tests/hwsim/build.sh
+++ b/tests/hwsim/build.sh
@@ -6,12 +6,33 @@ cd $(dirname $0)
usage()
{
- echo "$0 [-c | --codecov] [-f | --force-config]"
+ echo "$0 [-c | --codecov] [-f | --force-config[=<tls>|<ap-tls>/<sup-tls>]]"
exit 1
}
+# Re-derive $2 (hostapd/.config or wpa_supplicant/.config) from $1
+# (the example config), optionally overriding CONFIG_TLS to $3
+sync_config()
+{
+ example="$1"
+ config="$2"
+ tls="$3"
+
+ tmp="$(mktemp)"
+ {
+ [ -n "$tls" ] && echo "CONFIG_TLS=$tls"
+ cat "$example"
+ } >"$tmp"
+
+ if [ ! -e "$config" ] || ! cmp "$tmp" "$config" >/dev/null 2>&1; then
+ cp "$tmp" "$config"
+ fi
+ rm -f "$tmp"
+}
+
use_lcov=0
force_config=0
+force_tls=""
while [ "$1" != "" ]; do
case $1 in
-c | --codecov ) shift
@@ -20,12 +41,30 @@ while [ "$1" != "" ]; do
;;
-f | --force-config ) shift
force_config=1
+ force_tls=""
echo "$0: force copy config specified"
;;
+ --force-config=* )
+ force_config=1
+ force_tls=${1#--force-config=}
+ shift
+ echo "$0: force copy config specified (TLS backend: $force_tls)"
+ ;;
* ) usage
esac
done
+case $force_tls in
+ */*)
+ ap_tls=${force_tls%%/*}
+ sup_tls=${force_tls#*/}
+ ;;
+ * )
+ ap_tls=$force_tls
+ sup_tls=$force_tls
+ ;;
+esac
+
JOBS=`nproc`
if [ -z "$ABC" ]; then
JOBS=8
@@ -46,9 +85,7 @@ make QUIET=1 CONFIG_NO_BROWSER=1
echo "Building hostapd"
cd ../../hostapd
if [ ! -e .config -o $force_config -eq 1 ]; then
- if ! cmp ../tests/hwsim/example-hostapd.config .config >/dev/null 2>&1 ; then
- cp ../tests/hwsim/example-hostapd.config .config
- fi
+ sync_config ../tests/hwsim/example-hostapd.config .config "$ap_tls"
fi
if [ $use_lcov -eq 1 ]; then
@@ -64,9 +101,7 @@ make QUIET=1 -j$JOBS hostapd hostapd_cli hlr_auc_gw
echo "Building wpa_supplicant"
cd ../wpa_supplicant
if [ ! -e .config -o $force_config -eq 1 ]; then
- if ! cmp ../tests/hwsim/example-wpa_supplicant.config .config >/dev/null 2>&1 ; then
- cp ../tests/hwsim/example-wpa_supplicant.config .config
- fi
+ sync_config ../tests/hwsim/example-wpa_supplicant.config .config "$sup_tls"
fi
if [ $use_lcov -eq 1 ]; then
diff --git a/tests/hwsim/example-hostapd.config b/tests/hwsim/example-hostapd.config
index 92338aae0..9b7e3bd2d 100644
--- a/tests/hwsim/example-hostapd.config
+++ b/tests/hwsim/example-hostapd.config
@@ -7,7 +7,7 @@ CONFIG_RSN_PREAUTH=y
#CONFIG_TLS=internal
#CONFIG_INTERNAL_LIBTOMMATH=y
#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
-CONFIG_TLS=openssl
+CONFIG_TLS?=openssl
CONFIG_EAP=y
CONFIG_ERP=y
@@ -118,14 +118,21 @@ CONFIG_TAXONOMY=y
CONFIG_FILS=y
CONFIG_FILS_SK_PFS=y
CONFIG_OWE=y
+# HPKE (used by DPP) is not implemented for the wolfssl TLS backend.
+ifneq ($(CONFIG_TLS), wolfssl)
CONFIG_DPP=y
CONFIG_DPP2=y
CONFIG_DPP3=y
+endif
CONFIG_WEP=y
CONFIG_PASN=y
CONFIG_AIRTIME_POLICY=y
CONFIG_IEEE80211BE=y
+# pbkdf2_sha256/384 (used by NAN) are not implemented for the wolfssl TLS
+# backend.
+ifneq ($(CONFIG_TLS), wolfssl)
CONFIG_NAN_USD=y
+endif
CONFIG_PROCESS_COORDINATION=y
CONFIG_ENC_ASSOC=y
CONFIG_PMKSA_PRIVACY=y
diff --git a/tests/hwsim/example-wpa_supplicant.config b/tests/hwsim/example-wpa_supplicant.config
index f3c1727f6..5cbe47b25 100644
--- a/tests/hwsim/example-wpa_supplicant.config
+++ b/tests/hwsim/example-wpa_supplicant.config
@@ -1,6 +1,6 @@
#CC=ccache gcc
-CONFIG_TLS=openssl
+CONFIG_TLS?=openssl
#CONFIG_TLS=wolfssl
#CONFIG_TLS=internal
#CONFIG_INTERNAL_LIBTOMMATH=y
@@ -161,19 +161,25 @@ CONFIG_FILS=y
CONFIG_FILS_SK_PFS=y
CONFIG_PMKSA_CACHE_EXTERNAL=y
CONFIG_OWE=y
+# HPKE (used by DPP) is not implemented for the wolfssl TLS backend.
+ifneq ($(CONFIG_TLS), wolfssl)
CONFIG_DPP=y
CONFIG_DPP2=y
CONFIG_DPP3=y
+endif
CONFIG_WEP=y
CONFIG_PASN=y
+# pbkdf2_sha256/384 (used by NAN) are not implemented for the wolfssl TLS
+# backend.
+ifneq ($(CONFIG_TLS), wolfssl)
+CONFIG_NAN=y
CONFIG_NAN_USD=y
+endif
CONFIG_IEEE80211BE=y
CONFIG_IEEE80211BN=y
CONFIG_PROCESS_COORDINATION=y
-CONFIG_NAN=y
-
CONFIG_ENC_ASSOC=y
CONFIG_PMKSA_PRIVACY=y
CONFIG_IEEE8021X_AUTH=y
diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh
index 507488041..8a6154ef0 100755
--- a/tests/hwsim/run-all.sh
+++ b/tests/hwsim/run-all.sh
@@ -34,6 +34,7 @@ usage()
{
echo "$0 [-v | --valgrind | valgrind] [-t | --trace | trace]"
echo "\t[-n <num> | --channels <num>] [-B | --build]"
+ echo "\t[--force-config[=<tls>|<ap-tls>/<sup-tls>]]"
echo "\t[-c | --codecov ] [run-tests.py parameters]"
exit 1
}
@@ -69,11 +70,23 @@ while [ "$1" != "" ]; do
echo "$0: build before running tests"
BUILD=build
;;
+ --force-config) # don't handle "-f", would shadow run-tests.py option
+ shift
+ echo "$0: build before running tests (force copy config)"
+ BUILD=build
+ BUILD_ARGS="$BUILD_ARGS -f"
+ ;;
+ --force-config=*)
+ echo "$0: build before running tests (force copy config, TLS backend: ${1#--force-config=})"
+ BUILD=build
+ BUILD_ARGS="$BUILD_ARGS $1"
+ shift
+ ;;
-c | --codecov)
shift
echo "$0: using code coverage"
CODECOV=lcov
- BUILD_ARGS=-c
+ BUILD_ARGS="$BUILD_ARGS -c"
;;
-h | --help)
usage
--
2.50.1 (Apple Git-155)
More information about the Hostap
mailing list