[LTP] [PATCH v4 4/4] shell_loader_cmd.sh: New test case check needs_cmds

Petr Vorel pvorel@suse.cz
Fri Nov 7 12:41:51 CET 2025


Hi Wei,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

> --- /dev/null
> +++ b/testcases/lib/tests/shell_loader_cmd.sh
> @@ -0,0 +1,24 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2025 Wei Gao <wegao@suse.cz>
> +#
> +# ---
> +# env
> +# {
> +#  "needs_cmds": [
> +#   {
> +#    "cmd": "ls",
> +#    "optional": 1
> +#   }

Ideally we would also some test with an expression with version on "cmd",
e.g. "mkfs.ext4 >= 1.0.0" to make sure it's correctly handled. I know it's just
passing to the C library, but just for sure.

Kind regards,
Petr
> +#  ]
> +# }
> +# ---
> +
> +. tst_loader.sh
> +
> +tst_test()
> +{
> +	tst_res TPASS "We are running with needs_cmds"
> +}


More information about the ltp mailing list