Re: [LTP] [PATCH v2 1/3] lib: Ignore empty LTP_ENABLE_DEBUG

Li Wang via ltp
2026-03-27T03:51:40Z

On Thu, Mar 26, 2026 at 06:04:33PM +0100, Petr Vorel wrote:
> Empty LTP_ENABLE_DEBUG environment variable should be just ignored.
>
> This fixes warning:
> LTP_ENABLE_DEBUG= ./test05
> tst_test.c:1454: TWARN: Invalid LTP_ENABLE_DEBUG value:
>
> Fixes: e434de62b4 ("lib: Extend LTP_ENABLE_DEBUG to support verbosity levels")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Reviewed-by: Li Wang <liwang@redhat.com>

> ---
> lib/tst_test.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 2d62ab164d..4a22f2e477 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1445,13 +1445,13 @@ static void do_setup(int argc, char *argv[])
>
> parse_opts(argc, argv);
>
> - if (tdebug_env && !context->tdebug) {
> + if (tdebug_env && tdebug_env[0] != '\0' && !context->tdebug) {

Or, more shorten:

if (tdebug_env && *tdebug_env && !context->tdebug) {

--
Regards,
Li Wang