Skip to content

Commit e20f825

Browse files
Terence Trittonpevik
authored andcommitted
tst_test.sh: Replace GNU word boundary \b with \< in grep
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). Link: https://lore.kernel.org/ltp/20260630071639.2248082-1-wakel@google.com/ Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Terence Tritton <ttritton@google.com> Co-developed-by: Wake Liu <wakel@google.com> Signed-off-by: Wake Liu <wakel@google.com>
1 parent cc9206e commit e20f825

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

testcases/lib/tst_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ tst_run()
676676
local ret
677677

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

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

0 commit comments

Comments
 (0)