All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang via ltp <ltp@lists.linux.it>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 3/3] lib: Prefer LTP_DEBUG over -D
Date: Fri, 27 Mar 2026 11:45:37 +0800	[thread overview]
Message-ID: <acX9Yd23S0gfTJZa@redhat.com> (raw)
In-Reply-To: <20260326170435.22566-4-pvorel@suse.cz>

On Thu, Mar 26, 2026 at 06:04:35PM +0100, Petr Vorel wrote:
> Environment variable has usually higher preference than getopt.
> Also document it.
> 
> 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>

> @@ -825,13 +825,15 @@ static void parse_opts(int argc, char *argv[])
>  			tst_brk(TBROK, "Invalid option");
>  		break;
>  		case 'D':
> -			if (optarg)
> -				context->tdebug = SAFE_STRTOL(optarg, 1, 2);
> -			else
> -				context->tdebug = 1;
> -
> -			if (context->tdebug)
> -				tst_res(TINFO, "Enabling debug info (level %d)", context->tdebug);
> +			if (!getenv("LTP_DEBUG")) {

My preference is to shorten the code indentation:

  case 'D':
      if (getenv("LTP_DEBUG"))
          break;
  
      context->tdebug = optarg ? SAFE_STRTOL(optarg, 1, 2) : 1;

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

> +				if (optarg)
> +					context->tdebug = SAFE_STRTOL(optarg, 1, 2);
> +				else
> +					context->tdebug = 1;
> +
> +				if (context->tdebug)
> +					tst_res(TINFO, "Enabling debug info (level %d)", context->tdebug);
> +			}
>  		break;
>  		case 'h':
>  			print_help();
> -- 
> 2.53.0
> 

-- 
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-03-27  3:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 17:04 [LTP] [PATCH v2 0/3] lib: LTP_DEBUG cleanup Petr Vorel
2026-03-26 17:04 ` [LTP] [PATCH v2 1/3] lib: Ignore empty LTP_ENABLE_DEBUG Petr Vorel
2026-03-27  3:51   ` Li Wang via ltp
2026-03-27  9:38     ` Petr Vorel
2026-03-26 17:04 ` [LTP] [PATCH v2 2/3] lib: Rename variable LTP_ENABLE_DEBUG => LTP_DEBUG Petr Vorel
2026-03-27  3:47   ` Li Wang via ltp
2026-03-26 17:04 ` [LTP] [PATCH v2 3/3] lib: Prefer LTP_DEBUG over -D Petr Vorel
2026-03-27  3:45   ` Li Wang via ltp [this message]
2026-03-27 10:39 ` [LTP] [PATCH v2 0/3] lib: LTP_DEBUG cleanup Andrea Cervesato via ltp
2026-03-27 12:40   ` Petr Vorel
2026-03-27 15:46     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acX9Yd23S0gfTJZa@redhat.com \
    --to=ltp@lists.linux.it \
    --cc=liwang@redhat.com \
    --cc=pvorel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.