All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Seddon <dave.seddon.ca@gmail.com>
To: dave.seddon.ca@gmail.com, netdev@vger.kernel.org
Subject: [PATCH iproute2 2/3] testsuite: fix test_on_not on multi-line output
Date: Sat, 10 Oct 2026 20:29:05 -0700	[thread overview]
Message-ID: <20261011032906.1398174-3-dave.seddon.ca@gmail.com> (raw)
In-Reply-To: <20261011032906.1398174-1-dave.seddon.ca@gmail.com>

grep -vqE succeeds when any line does not match, even if another line
contains the forbidden pattern. It also fails on empty output.

Accept only exit status 1 from a non-inverted grep: the pattern was
not found. A matching line or a grep error must fail the assertion.

Assisted-by: LLM
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 testsuite/lib/generic.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/testsuite/lib/generic.sh b/testsuite/lib/generic.sh
index 8b339ec1..ac48f023 100644
--- a/testsuite/lib/generic.sh
+++ b/testsuite/lib/generic.sh
@@ -113,8 +113,9 @@ test_on()
 
 test_on_not()
 {
-	echo -n "test on: \"$1\""
-	if cat "$STD_OUT" | grep -vqE "$1"
+	echo -n "test on absence: \"$1\""
+	grep -qE -- "$1" "$STD_OUT"
+	if [ "$?" -eq 1 ]
 	then
 		pr_success
 	else
-- 
2.55.0


  parent reply	other threads:[~2026-10-11  3:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11  3:29 [PATCH iproute2 0/3] iplink: bond: fix partner LACP state decoding Dave Seddon
2026-10-11  3:29 ` [PATCH iproute2 1/3] iplink_bond_slave: read ad_partner_oper_port_state as u16 Dave Seddon
2026-10-11  3:29 ` Dave Seddon [this message]
2026-10-11  3:29 ` [PATCH iproute2 3/3] testsuite: add bond slave LACP port state test Dave Seddon
2026-10-19 17:19   ` Stephen Hemminger

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=20261011032906.1398174-3-dave.seddon.ca@gmail.com \
    --to=dave.seddon.ca@gmail.com \
    --cc=netdev@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.