From: Florian Westphal Date: Thu, 9 Jul 2026 20:03:55 +0000 (+0200) Subject: tests: check_klog.sh: unclutter stderr X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f14abdff13f1e53904edfc7bda5f48b1ac576e02;p=thirdparty%2Fipset.git tests: check_klog.sh: unclutter stderr My test vm doesn't have a kern.log file, but the existing script will fall back to dmesg which is good enough for me. Suppress the 'no such file' error from tail and go straight to the dmesg fallback. Signed-off-by: Florian Westphal Signed-off-by: Jozsef Kadlecsik --- diff --git a/tests/check_klog.sh b/tests/check_klog.sh index 8ecad3e..bc602be 100755 --- a/tests/check_klog.sh +++ b/tests/check_klog.sh @@ -44,7 +44,12 @@ port=$1; shift set +e for setname in $@; do - match=`tail -n +$loglines /var/log/kern.log | grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*"` + if [ -r /var/log/kern.log ]; then + match=`tail -n +$loglines /var/log/kern.log | grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*"` + else + match="" + fi + if [ -z "$match" ]; then match=`dmesg | tail -n +$loglines | grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*"` fi diff --git a/tests/sendip.sh b/tests/sendip.sh index f80b24a..d1f8ebe 100755 --- a/tests/sendip.sh +++ b/tests/sendip.sh @@ -1,6 +1,5 @@ #!/bin/bash # Save lineno for checking -wc -l /var/log/kern.log | cut -d ' ' -f 1 > "$IPSET_TMP/.loglines" +wc -l /var/log/kern.log 2>/dev/null | cut -d ' ' -f 1 > "$IPSET_TMP/.loglines" sendip "$@" -