* [LTP] [PATCH] tst_test.sh: Reduce false positives in reserved variable warnings
@ 2019-08-09 7:52 Petr Vorel
2019-08-09 12:16 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2019-08-09 7:52 UTC (permalink / raw)
To: ltp
"Reserved variable TST_FOO used!" and "Private variable or function
_tst_foo used!" reports some false positive.
Filter out commented code and variables and functions not starting with
searched prefix (foo_tst_bar() or $foo_tst_bar).
NOTE: There are still some false positives (e.g. echo "echo
TST_SHOULD_NOT_BE_FOUND"), but let's not complicate the regexp too much.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
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 31b3a3951..f779cc471 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -402,7 +402,7 @@ tst_run()
local _tst_name
if [ -n "$TST_TEST_PATH" ]; then
- for _tst_i in $(grep TST_ "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`].*//'); do
+ for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`].*//'); do
case "$_tst_i" in
DISABLE_APPARMOR|DISABLE_SELINUX);;
SETUP|CLEANUP|TESTFUNC|ID|CNT|MIN_KVER);;
@@ -417,7 +417,7 @@ tst_run()
esac
done
- for _tst_i in $(grep _tst_ "$TST_TEST_PATH" | sed 's/.*_tst_//; s/[="} \t\/:`].*//'); do
+ for _tst_i in $(grep '^[^#]*\b_tst_' "$TST_TEST_PATH" | sed 's/.*_tst_//; s/[="} \t\/:`].*//'); do
tst_res TWARN "Private variable or function _tst_$_tst_i used!"
done
fi
--
2.22.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] tst_test.sh: Reduce false positives in reserved variable warnings
2019-08-09 7:52 [LTP] [PATCH] tst_test.sh: Reduce false positives in reserved variable warnings Petr Vorel
@ 2019-08-09 12:16 ` Cyril Hrubis
2019-08-09 13:48 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2019-08-09 12:16 UTC (permalink / raw)
To: ltp
Hi!
Looks good, acked.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] tst_test.sh: Reduce false positives in reserved variable warnings
2019-08-09 12:16 ` Cyril Hrubis
@ 2019-08-09 13:48 ` Petr Vorel
0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2019-08-09 13:48 UTC (permalink / raw)
To: ltp
Hi Cyril,
> Hi!
> Looks good, acked.
Thanks for review, merged.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-09 13:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 7:52 [LTP] [PATCH] tst_test.sh: Reduce false positives in reserved variable warnings Petr Vorel
2019-08-09 12:16 ` Cyril Hrubis
2019-08-09 13:48 ` Petr Vorel
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.