All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wake Liu via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: ttritton@google.com, Wake Liu <wakel@google.com>
Subject: [LTP] [PATCH] tst_test.sh: Replace GNU word boundary \b with \< in grep
Date: Tue, 30 Jun 2026 07:16:39 +0000	[thread overview]
Message-ID: <20260630071639.2248082-1-wakel@google.com> (raw)

From: Terence Tritton <ttritton@google.com>

The regex word boundary extension '\b' is a GNU extension and is not
supported by Toybox and lightweight POSIX regex implementations
(such as Bionic libc), causing grep to fail with:

    grep: bad regex '^[^#]*\bTST_': trailing backslash (\)

Replace '\b' with '\<' to ensure shell tests run correctly on
lightweight environments such as Android (Toybox).

Signed-off-by: Terence Tritton <ttritton@google.com>
Co-developed-by: Wake Liu <wakel@google.com>
Signed-off-by: Wake Liu <wakel@google.com>
---
 testcases/lib/tst_test.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 1234567..89abcdef 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -679,7 +679,7 @@ tst_run()
 	local ret

 	if [ -n "$TST_TEST_PATH" ]; then
-		for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed "s/.*TST_//; s/$_tst_pattern//"); do
+		for _tst_i in $(grep '^[^#]*\<TST_' "$TST_TEST_PATH" | sed "s/.*TST_//; s/$_tst_pattern//"); do
 			case "$_tst_i" in
 			ALL_FILESYSTEMS|DISABLE_APPARMOR|DISABLE_SELINUX);;
 			SETUP|CLEANUP|TESTFUNC|ID|CNT|MIN_KVER);;
@@ -701,7 +701,7 @@ tst_run()
 			esac
 		done

-		for _tst_i in $(grep '^[^#]*\b_tst_' "$TST_TEST_PATH" | sed "s/.*_tst_//; s/$_tst_pattern//"); do
+		for _tst_i in $(grep '^[^#]*\<_tst_' "$TST_TEST_PATH" | sed "s/.*_tst_//; s/$_tst_pattern//"); do
 			tst_res TWARN "Private variable or function _tst_$_tst_i used!"
 		done
 	fi
-- 
2.45.2

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-06-30  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  7:16 Wake Liu via ltp [this message]
2026-06-30  8:09 ` [LTP] [PATCH] tst_test.sh: Replace GNU word boundary \b with \< in grep Petr Vorel
2026-07-01  2:26   ` Wake Liu via ltp

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=20260630071639.2248082-1-wakel@google.com \
    --to=ltp@lists.linux.it \
    --cc=ttritton@google.com \
    --cc=wakel@google.com \
    /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.