From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: kadlec@netfilter.org, Florian Westphal <fw@strlen.de>
Subject: [PATCH ipset 4/7] tests: check_klog.sh: unclutter stderr
Date: Thu, 9 Jul 2026 22:03:55 +0200 [thread overview]
Message-ID: <20260709200358.15504-5-fw@strlen.de> (raw)
In-Reply-To: <20260709200358.15504-1-fw@strlen.de>
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 <fw@strlen.de>
---
tests/check_klog.sh | 7 ++++++-
tests/sendip.sh | 3 +--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/check_klog.sh b/tests/check_klog.sh
index 8ecad3eb987e..bc602be839aa 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 f80b24ab49b8..d1f8ebe4d75b 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 "$@"
-
--
2.54.0
next prev parent reply other threads:[~2026-07-09 20:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 20:03 [PATCH ipset 0/7] test updates Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 1/7] tests: make runtest.sh work with readonly-cwd Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 2/7] tests: runtest.sh: run inside namespace Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 3/7] tests: diff.sh: preserve file name Florian Westphal
2026-07-09 20:03 ` Florian Westphal [this message]
2026-07-09 20:03 ` [PATCH ipset 5/7] tests: setlist_ns.sh: use local ipset binary and don't rely on userns Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 6/7] tests: make setlist_resize.sh more verbose on error Florian Westphal
2026-07-09 20:03 ` [PATCH ipset 7/7] tests: runtest.sh: add sendip emulation via scapy Florian Westphal
2026-07-13 13:35 ` [PATCH ipset 0/7] test updates Jozsef Kadlecsik
2026-07-13 14:11 ` Pablo Neira Ayuso
2026-07-13 14:25 ` Jozsef Kadlecsik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260709200358.15504-5-fw@strlen.de \
--to=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.