[LTP] [RFC PATCH v6 3/5] tst_test.sh: Filter out commented out lines from warnings

Petr Vorel pvorel@suse.cz
Mon Jun 4 23:34:20 CEST 2018


Hi Cyril,


> Hi!
> What is the usecase for this?

> I know that comments does not count as a code but why would the test
> need to comment with a reserved name in it?
OK, let's drop it.

> > ---
> >  testcases/lib/tst_test.sh | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)

> > diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> > index de5d65039..098ff7bd2 100644
> > --- a/testcases/lib/tst_test.sh
> > +++ b/testcases/lib/tst_test.sh
> > @@ -244,13 +244,21 @@ _tst_rescmp()
> >  	fi
> >  }

> > +_tst_get_used_var()
> > +{
> > +	local _tst_pattern="$1"
> > +
> > +	grep $_tst_pattern "$TST_TEST_PATH" | grep -v '^[[:space:]]*#' | \
> > +		sed "s/.*${_tst_pattern}//;"' s/[="} \t\/:`].*//'

> As far as I can tell this does not work for:

> foo # run function foo
Not sure what you expected. The behavior is:

* no warning for:
  # _tst_foo run function _tst_foo

* warning for:
  _tst_foo # run function _tst_foo

I take it as your NACK anyway :).

Kind regards,
Petr


More information about the ltp mailing list