[LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant

Petr Vorel pvorel@suse.cz
Tue Feb 25 09:02:14 CET 2025


> Hi!
> > > > -	if (tst_test->test_variants)
> > > > +	if (tst_test->test_variants) {
> > > >  		test_variants = tst_test->test_variants;
> > > > +		only_variant = getenv("LTP_SINGLE_VARIANT");
> > > > +		if (only_variant && only_variant[0] != '\0') {
> > > > +			tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
> > > > +							  test_variants - 1);
> > > > +			tst_res(TINFO, "WARNING: testing only variant %d of %d",
> > > > +					tst_variant, test_variants - 1);
> > > > +			test_variants = tst_variant + 1;
> > > > +		}
> > > > +	}
> > > > +
> > > > +	for (; tst_variant < test_variants; tst_variant++) {

> > > > -	for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
> > > >  		if (tst_test->all_filesystems || count_fs_descs() > 1)
> > > >  			ret |= run_tcases_per_fs();
> > > >  		else

> > > Can we instead add a function that would set two integer variables,
> > > first_variant and last variant as:

> > > static void setup_variants(unsigned int *first_variant, unsigned int *last_variant)
> > > {
> > > 	//setup the defaults and parse the variables here
> > > }

> > Sure, I'll send v2 if you see the patch useful (Li was not sure if this is
> > useful).

> I do not have a strong opinion here, it may be mildly useful for test
> development, in some rare circumstances.

Yeah, that's why I put "Testing only" in the help.

Kind regards,
Petr


More information about the ltp mailing list