Skip to contentSkip to conversation

tst_test.sh: More readable syntax

PATCH New Petr Vorel 2 participants 3 messages Sep 22, 2020 – Sep 23, 2020

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 tst_test.sh: More readable syntax

"for cmd; do" works the same way as "for cmd in $*; do", but the latter is more readable. Also sync the code with tst_require_cmds().

Fixes dba1d50cb ("tst_test.sh: Add test cmd helper tst_check_cmds()")
---
 testcases/lib/tst_test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/lib/tst_test.sh +1 -1
index fa97acbac..f2bd1e3ef 100644
@@ -350,7 +350,7 @@ tst_require_cmds()
 tst_check_cmds()
 {
 	local cmd
-	for cmd; do
+	for cmd in $*; do
 		if ! tst_cmd_available $cmd; then
 			tst_res TCONF "'$cmd' not found"
 			return 1
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 tst_test.sh: More readable syntax

Quoted 7 lines · Petr Vorel

"for cmd; do" works the same way as "for cmd in $*; do", but the latter is more readable. Also sync the code with tst_require_cmds().

Fixes dba1d50cb ("tst_test.sh: Add test cmd helper tst_check_cmds()")
Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200923/5332a357/attachment.htm>
author
#2 lore raw

PATCH 1/1 tst_test.sh: More readable syntax

Hi Li,

Quoted 11 lines · Petr Vorel
Quoted 7 lines

"for cmd; do" works the same way as "for cmd in $*; do", but the latter is more readable. Also sync the code with tst_require_cmds().

Fixes dba1d50cb ("tst_test.sh: Add test cmd helper tst_check_cmds()")

Thanks for a review, merged.

Kind regards,
Petr