[LTP] [PATCH v3 03/10] tst_test.sh: Allow $ ; after whitelisted variable
Petr Vorel
pvorel@suse.cz
Thu Aug 4 14:19:39 CEST 2022
Variable followed by other variable was not whitelisted:
e.g.:
$TST_FS_TYPE$pattern
TWARN: Reserved variable TST_FS_TYPE$ used!
for i in $SKIP_FILESYSTEMS; do
TWARN: Reserved variable TST_SKIP_FILESYSTEMS used!
Also use the same patter for second grep for detection of _tst_*
functions variables.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
New in v3
testcases/lib/tst_test.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index b7cf5f3d4..3494f7786 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -625,9 +625,10 @@ tst_run()
local _tst_data
local _tst_max
local _tst_name
+ local _tst_pattern='[='\''"} \t\/:`$\;].*'
if [ -n "$TST_TEST_PATH" ]; then
- for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[='\''"} \t\/:`].*//'); do
+ for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed "s/.*TST_//; s/$_tst_pattern//"); do
case "$_tst_i" in
DISABLE_APPARMOR|DISABLE_SELINUX);;
SETUP|CLEANUP|TESTFUNC|ID|CNT|MIN_KVER);;
@@ -647,7 +648,7 @@ tst_run()
esac
done
- for _tst_i in $(grep '^[^#]*\b_tst_' "$TST_TEST_PATH" | sed 's/.*_tst_//; s/[="} \t\/:`].*//'); do
+ for _tst_i in $(grep '^[^#]*\b_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.37.1
More information about the ltp
mailing list