[LTP] [PATCH v2 2/4] lib/C-API: Add option -V to print LTP version

Petr Vorel pvorel@suse.cz
Tue Jul 25 14:23:25 CEST 2023


Hi Cyril,

> Hi!
> > It can be useful for troubleshooting reported issues.

> I still wonder if this should be rather put into the output of the -h or
> both.

I used -V, because this is common, but I have no problem to add it to -h
or even move to -h (i.e. not introduce -V).

Any more opinions, please?

Kind regards,
Petr

> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  lib/tst_test.c | 6 ++++++
> >  1 file changed, 6 insertions(+)

> > diff --git a/lib/tst_test.c b/lib/tst_test.c
> > index 04da456c6..456d3d1e6 100644
> > --- a/lib/tst_test.c
> > +++ b/lib/tst_test.c
> > @@ -34,6 +34,7 @@
> >  #include "old_resource.h"
> >  #include "old_device.h"
> >  #include "old_tmpdir.h"
> > +#include "ltp-version.h"

> >  /*
> >   * Hack to get TCID defined in newlib tests
> > @@ -509,6 +510,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 LTP version"},
> >  	{"C:", "-C ARG   Run child process with ARG arguments (used internally)"},
> >  };

> > @@ -686,6 +688,10 @@ static void parse_opts(int argc, char *argv[])
> >  			else
> >  				duration = SAFE_STRTOF(optarg, 0.1, HUGE_VALF);
> >  		break;
> > +		case 'V':
> > +			fprintf(stderr, "LTP version: " LTP_VERSION "\n");
> > +			exit(0);
> > +		break;
> >  		case 'C':
> >  #ifdef UCLINUX
> >  			child_args = optarg;
> > -- 
> > 2.40.1


More information about the ltp mailing list