[LTP] new shell library

Jan Stancek
2016-10-12T14:54:44Z

----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Wednesday, 12 October, 2016 3:17:26 PM
> Subject: Re: [LTP] new shell library
>
> Hi!
> > What about greping the test source as in [2] instead? Because that way
> > we can print error if the test source touches any of the internally used
> > variables as well. For instance if it tries to do anything with
> > TST_PASS/TST_FAIL/...

True.

>
> What about this one:
>
> https://github.com/metan-ucw/ltp/commit/445e3ae253bdd11f18ec12ccc74fe99eb582eeb6

Looks OK, chances of someone making MYTST_VARIABLE is quite small,
and we can always improve that regex if needed.

Couple notes:
- these seem to be missing: TST_DEVICE, TST_MODPATH, TST_CHECKPOINT_*, TST_NEEDS_CHECKPOINTS
- doc page mentions "TST_NEEDS_CMD" and "TST_NEEDS_CMDS", the latter looks like typo.

Regards,
Jan

>
> $ cat d.sh
>
> #!/bin/sh
> TST_ID="test"
> TST_TESTFUNC=do_test
> . tst_test.sh
>
> do_test()
> {
> tst_res TPASS "Passed"
>
> TST_FOO=1
>
> echo "$TST_PASS"
> }
>
> tst_run
>
> # PATH is set to contain both path to tst_test.sh and d.sh
> $ ./d.sh
> test 1 TWARN : Reserved variable TST_FOO used!
> test 1 TWARN : Reserved variable TST_PASS used!
> test 1 TPASS : Passed
> 1
>
> Summary:
> passed 1
> failed 0
> skipped 0
> warnings 2
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>