[LTP] [PATCH 3/3] lib: shell: Switch cmd.optional to bool

Cyril Hrubis chrubis@suse.cz
Thu Jan 22 14:20:59 CET 2026


Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/lib/tests/shell_loader_cmd.sh | 4 ++--
 testcases/lib/tst_run_shell.c           | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/lib/tests/shell_loader_cmd.sh b/testcases/lib/tests/shell_loader_cmd.sh
index 4e8e61eb6..1fba2a193 100755
--- a/testcases/lib/tests/shell_loader_cmd.sh
+++ b/testcases/lib/tests/shell_loader_cmd.sh
@@ -8,11 +8,11 @@
 #  "needs_cmds": [
 #   {
 #    "cmd": "ls",
-#    "optional": 1
+#    "optional": true
 #   },
 #   {
 #    "cmd": "mkfs.ext4 >= 1.0.0",
-#    "optional": 1
+#    "optional": true
 #   }
 #  ]
 # }
diff --git a/testcases/lib/tst_run_shell.c b/testcases/lib/tst_run_shell.c
index ddcb606b2..c12361ef5 100644
--- a/testcases/lib/tst_run_shell.c
+++ b/testcases/lib/tst_run_shell.c
@@ -186,7 +186,7 @@ enum cmd_ids {
 
 static ujson_obj_attr cmd_attrs[] = {
 	UJSON_OBJ_ATTR_IDX(CMD, "cmd", UJSON_STR),
-	UJSON_OBJ_ATTR_IDX(OPTIONAL, "optional", UJSON_INT),
+	UJSON_OBJ_ATTR_IDX(OPTIONAL, "optional", UJSON_BOOL),
 };
 
 static ujson_obj cmd_obj = {
@@ -299,7 +299,7 @@ static struct tst_cmd *parse_cmds(ujson_reader *reader, ujson_val *val)
 				ret[i].cmd = strdup(val->val_str);
 			break;
 			case OPTIONAL:
-				ret[i].optional = val->val_int;
+				ret[i].optional = val->val_bool;
 			break;
 			}
 		}
-- 
2.52.0



More information about the ltp mailing list