[LTP] [PATCH 2/8] tst_cmd.c: Check brk_nosupp when tst_get_path failed

Petr Vorel pvorel@suse.cz
Fri Nov 7 11:29:33 CET 2025


From: Wei Gao <wegao@suse.com>

Fixes: 257394e4e3 ("Filter mkfs version in tst_fs")
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Wei Gao <wegao@suse.com>
[ pvorel: fix return value: 1 => false ]
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
NOTE: this replaces Wei's patch
https://patchwork.ozlabs.org/project/ltp/patch/20251107003041.28929-2-wegao@suse.com/
https://lore.kernel.org/ltp/20251107003041.28929-2-wegao@suse.com/

 lib/tst_cmd.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/tst_cmd.c b/lib/tst_cmd.c
index 2faf7c7430..79f547ab5d 100644
--- a/lib/tst_cmd.c
+++ b/lib/tst_cmd.c
@@ -265,8 +265,14 @@ bool tst_check_cmd(const char *cmd, const int brk_nosupp)
 	version_token = strtok_r(NULL, " ", &next);
 	str = strtok_r(NULL, " ", &next);
 
-	if (tst_get_path(cmd_token, path, sizeof(path)))
-		tst_brkm(TCONF, NULL, "Couldn't find '%s' in $PATH", cmd_token);
+	if (tst_get_path(cmd_token, path, sizeof(path))) {
+		if (brk_nosupp) {
+			tst_brkm(TCONF, NULL, "Couldn't find '%s' in $PATH", cmd_token);
+		} else {
+			tst_resm(TCONF, "Couldn't find '%s' in $PATH", cmd_token);
+			return false;
+		}
+	}
 
 	if (!op_token)
 		return true;
-- 
2.51.0



More information about the ltp mailing list