summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Lici <ralf@mandelbit.com>2026-03-23 15:32:26 +0100
committerAntonio Quartulli <antonio@openvpn.net>2026-04-17 10:54:03 +0200
commitc409da0fe15e2b2aae7f93edbab977e23117ce4d (patch)
tree3c1228637140fb9ad46fa6b83196805eb46c4aa0
parente5fd34ab8dff6c5bd4f2e9ee4f3945b79e511068 (diff)
selftests: ovpn: fail notification check on mismatch
compare_ntfs doesn't fail when expected and received notification streams diverge. Fix this bug by tracking the diff exit status explicitly and return it to the caller so notification mismatches propagate as test failures. Fixes: 77de28cd7cf1 ("selftests: ovpn: add notification parsing and matching") Signed-off-by: Ralf Lici <ralf@mandelbit.com> Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
-rw-r--r--tools/testing/selftests/net/ovpn/common.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/ovpn/common.sh b/tools/testing/selftests/net/ovpn/common.sh
index 4c08f756e63a..c92415aaddfc 100644
--- a/tools/testing/selftests/net/ovpn/common.sh
+++ b/tools/testing/selftests/net/ovpn/common.sh
@@ -140,23 +140,35 @@ add_peer() {
}
compare_ntfs() {
+ local diff_rc=0
+ local diff_file
+
if [ ${#tmp_jsons[@]} -gt 0 ]; then
suffix=""
[ "${SYMMETRIC_ID}" -eq 1 ] && suffix="${suffix}-symm"
[ "$FLOAT" == 1 ] && suffix="${suffix}-float"
expected="json/peer${1}${suffix}.json"
received="${tmp_jsons[$1]}"
+ diff_file=$(mktemp)
kill -TERM ${listener_pids[$1]} || true
wait ${listener_pids[$1]} || true
printf "Checking notifications for peer ${1}... "
if diff <(jq -s "${JQ_FILTER}" ${expected}) \
- <(jq -s "${JQ_FILTER}" ${received}); then
+ <(jq -s "${JQ_FILTER}" ${received}) \
+ >"${diff_file}" 2>&1; then
echo "OK"
+ else
+ diff_rc=$?
+ echo "failed"
+ cat "${diff_file}"
fi
+ rm -f "${diff_file}" || true
rm -f ${received} || true
fi
+
+ return "${diff_rc}"
}
cleanup() {