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

Petr Vorel
2026-03-26T17:05:38Z

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>
---
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) {
if (!strcmp(tdebug_env, "2"))
context->tdebug = 2;
else if (!strcmp(tdebug_env, "1") || !strcmp(tdebug_env, "y"))
context->tdebug = 1;
else
- tst_res(TWARN, "Invalid LTP_ENABLE_DEBUG value: %s", tdebug_env);
+ tst_res(TWARN, "Invalid LTP_ENABLE_DEBUG value: '%s'", tdebug_env);

if (context->tdebug)
tst_res(TINFO, "Enabling debug info (level %d)", context->tdebug);
--
2.53.0