Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] tst_test.sh: Replace GNU word boundary \b with \< in grep
@ 2026-06-30  7:16 Wake Liu via ltp
  2026-06-30  8:09 ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Wake Liu via ltp @ 2026-06-30  7:16 UTC (permalink / raw)
  To: ltp; +Cc: ttritton, Wake Liu

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] tst_test.sh: Replace GNU word boundary \b with \< in grep
  2026-06-30  7:16 [LTP] [PATCH] tst_test.sh: Replace GNU word boundary \b with \< in grep Wake Liu via ltp
@ 2026-06-30  8:09 ` Petr Vorel
  2026-07-01  2:26   ` Wake Liu via ltp
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2026-06-30  8:09 UTC (permalink / raw)
  To: Wake Liu; +Cc: ttritton, ltp

Hi Terence, Wake,

> 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 (\)

Thanks, merged.

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

Out of curiosity, in the end you plan to use LTP shell tests? Although skipped
tests did not mention any shell test, we did not expect you'd be running it.
FYI tst_test.sh (aka "new API") is being slowly replaced by new "shell loader"
API [2] (or tests are rewritten in C).

I also wonder if you use our new runner kirk already [3].

Kind regards,
Petr

[1] https://android.googlesource.com/platform/external/ltp/+/refs/heads/main/android/skipped-tests.txt
[2] https://linux-test-project.readthedocs.io/en/latest/developers/api_shell_tests.html
[3] https://github.com/linux-test-project/kirk

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] tst_test.sh: Replace GNU word boundary \b with \< in grep
  2026-06-30  8:09 ` Petr Vorel
@ 2026-07-01  2:26   ` Wake Liu via ltp
  0 siblings, 0 replies; 3+ messages in thread
From: Wake Liu via ltp @ 2026-07-01  2:26 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ttritton, ltp

Hi Petr,
On Tue, Jun 30, 2026 at 4:09 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> Thanks, merged.
Thanks for the fast merge!
> Out of curiosity, in the end you plan to use LTP shell tests? Although skipped
> tests did not mention any shell test, we did not expect you'd be running it.
> FYI tst_test.sh (aka "new API") is being slowly replaced by new "shell loader"
> API [2] (or tests are rewritten in C).
While Android VTS mostly runs C binaries, some test suites (like
controllers.memcg_control) still source tst_test.sh. Since Android's
Toybox uses Bionic libc, which strictly implements POSIX regex without
GNU \b, this fix prevents regex parsing failures. It is great news
that more tests are migrating to pure C.
> I also wonder if you use our new runner kirk already [3].
We haven't adopted kirk yet, as our LTP execution is deeply integrated
into Google's Trade Federation (Tradefed) and VTS automation (via atest).
We will definitely keep an eye on it as it evolves.
Kind regards,
Wake

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-01  2:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30  7:16 [LTP] [PATCH] tst_test.sh: Replace GNU word boundary \b with \< in grep Wake Liu via ltp
2026-06-30  8:09 ` Petr Vorel
2026-07-01  2:26   ` Wake Liu via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox