[LTP] [PATCH v3 2/3] lib: Add support for TDEBUG tst_res() flag
Cyril Hrubis
chrubis@suse.cz
Thu Dec 14 10:41:49 CET 2023
Hi!
> > > diff --git a/lib/tst_test.c b/lib/tst_test.c
> > > index c2f8f503f..f5c87ed9e 100644
> > > --- a/lib/tst_test.c
> > > +++ b/lib/tst_test.c
> > > @@ -60,6 +60,7 @@ static pid_t main_pid, lib_pid;
> > > static int mntpoint_mounted;
> > > static int ovl_mounted;
> > > static struct timespec tst_start_time; /* valid only for test pid */
> > > +static int tdebug;
>
> > > struct results {
> > > int passed;
> > > @@ -224,6 +225,9 @@ static void print_result(const char *file, const int lineno, int ttype,
> > > case TINFO:
> > > res = "TINFO";
> > > break;
> > > + case TDEBUG:
> > > + res = "TDEBUG";
> > > + break;
> > > default:
> > > tst_brk(TBROK, "Invalid ttype value %i", ttype);
> > > abort();
> > > @@ -352,6 +356,9 @@ void tst_res_(const char *file, const int lineno, int ttype,
> > > {
> > > va_list va;
>
> > > + if (ttype == TDEBUG && !tdebug)
> > > + return;
> > > +
> > > va_start(va, fmt);
> > > tst_vres_(file, lineno, ttype, fmt, va);
> > > va_end(va);
> > > @@ -511,6 +518,7 @@ static struct option {
> > > {"h", "-h Prints this help"},
> > > {"i:", "-i n Execute test n times"},
> > > {"I:", "-I x Execute test for n seconds"},
> > > + {"v", "-v Prints debug information"},
>
> > Maybe this should now be called -d since we call it TDEBUG and that will
> > avoid having a bit confusing parameters with both -v and -V used.
>
> Yes, I didn't like the flag name does not correspond to the option.
> I previously wrote that more tests use -d for something else:
>
> $ git grep '"d:"' $(git grep -l tst_option)
> testcases/kernel/fs/read_all/read_all.c: {"d:", &root_dir,
> testcases/kernel/io/ltp-aiodio/aio-stress.c: { "d:", &str_depth, "Number of pending aio requests for each file (default 64)" },
> testcases/network/netstress/netstress.c: {"d:", &rpath, "Path to file where result is saved"},
> testcases/network/nfs/nfs_stress/nfs05_make_tree.c: {"d:", &d_arg, "Number of subdirs to generate, default: 100"},
> testcases/network/stress/route/route-change-netlink.c: {"d:", &d_opt, "Interface to work on (mandatory)"},
>
> Hopefully all could be changed to -D in separate commits.
Or we can use -D for TDEBUG. I suppose that we use -V for version for
the same reason.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list