From: Vsevolod Stakhov Date: Fri, 17 Oct 2025 13:26:34 +0000 (+0100) Subject: [Test] Fix AWK syntax error in integration test analysis X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc55879356591bccfaf0e60bb4ca5adbbc715de2;p=thirdparty%2Frspamd.git [Test] Fix AWK syntax error in integration test analysis Add default values for count variables to prevent division errors when jq returns empty results --- diff --git a/test/integration/scripts/integration-test.sh b/test/integration/scripts/integration-test.sh index bac73364e1..c362cc7f99 100755 --- a/test/integration/scripts/integration-test.sh +++ b/test/integration/scripts/integration-test.sh @@ -192,6 +192,11 @@ if [ "$TOTAL" -eq 0 ]; then exit 1 fi +# Ensure counts are numeric (default to 0 if empty) +FUZZY_COUNT=${FUZZY_COUNT:-0} +BAYES_SPAM_COUNT=${BAYES_SPAM_COUNT:-0} +BAYES_HAM_COUNT=${BAYES_HAM_COUNT:-0} + # Calculate percentages using awk FUZZY_RATE=$(awk "BEGIN {printf \"%.1f\", ($FUZZY_COUNT / $TOTAL) * 100}") BAYES_SPAM_RATE=$(awk "BEGIN {printf \"%.1f\", ($BAYES_SPAM_COUNT / $TOTAL) * 100}")