From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] new shell library
Date: Tue, 4 Oct 2016 05:02:13 -0400 (EDT) [thread overview]
Message-ID: <1484818671.202716.1475571733691.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20161004084532.GA29418@rei.lan>
----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Tuesday, 4 October, 2016 10:45:32 AM
> Subject: Re: new shell library
>
> Hi!
> > As a person who sees this first time, my immediate concern was,
> > how do I know what variables functions names are reserved
> > (without need to read entire tst_test.sh) and what happens if
> > I make a typo?
> >
> > It also forces me to use specific names as the names
> > of my functions (e.g. "test", which presumably shadows test(1)).
>
> That is a valid concern. I guess that passing everyting
> (setup/cleanup/test/etc.) via TST_FOO variables would be much better.
>
> I was trying to reduce the number of lines per test as much as possible
> but this is perhaps too agressive and the end result is complicated
> automagic that is hard to understand.
>
> > And there's now requirement on when you can include new library,
> > it has to be at the end of file, because there are side-effects
> > (it starts the test on inclusion).
> >
> > So, I was thinking:
> >
> > . tst_test.sh
> >
> > ...
> >
> > tst_def TID="du01"
> > tst_def TCNT=23
> > tst_def TST_SETUP mysetup
> > tst_def TST_CLEANUP mycleanup
> > tst_def TST_TESTFUNC mytest
> > tst_def TST_NEEDS_TMPDIR=1
> > tst_def TST_NEEDS_CMDS="dd du stat"
> > tst_start
> >
> > tst_def - makes it clear that this variable defines something for tst_test,
> > checks for potential typos, doesn't allow non-existent ones,
> > is a single place in tst_test.sh where I can see all possible
> > variables together
>
> Hmm, I do not like this indirection too much. This obscures what is
> happening in similar manner to my automagic.
>
> What about we do it as:
>
> TST_ID="du01"
> TST_CNT=23
> TST_SETUP=setup
> TST_CLEANUP=cleanup
> TST_TESTFUNC=du_test
> TST_NEEDS_TMPDIR=1
> TST_NEEDS_CMDS="dd du stat"
> . tst_test.sh
>
> # the actuall test code
>
> tst_run
OK, giving all uniform names (TST_) and adding setup/cleanup/testfunc
makes it more clear.
What role does ". tst_test.sh" have in example above? Does it
have to come after you define all variables? If so, what does
it do?
If we have tst_run, then it seems that could do all necessary
checks and setup and we could include tst_test.sh at any point.
Regards,
Jan
next prev parent reply other threads:[~2016-10-04 9:02 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-03 14:58 [LTP] new shell library Cyril Hrubis
2016-10-04 8:23 ` Jan Stancek
2016-10-04 8:45 ` Cyril Hrubis
2016-10-04 9:02 ` Jan Stancek [this message]
2016-10-04 9:35 ` Cyril Hrubis
2016-10-04 9:54 ` Jan Stancek
2016-10-04 11:50 ` Cyril Hrubis
2016-10-12 10:08 ` Cyril Hrubis
2016-10-12 10:32 ` Jan Stancek
2016-10-12 12:36 ` Cyril Hrubis
2016-10-12 13:17 ` Cyril Hrubis
2016-10-12 14:54 ` Jan Stancek
2016-10-12 15:06 ` Cyril Hrubis
2016-10-13 15:43 ` Cyril Hrubis
2016-10-27 14:58 ` Cyril Hrubis
2016-10-31 10:03 ` Jan Stancek
2016-10-31 10:39 ` Cyril Hrubis
2016-11-14 13:12 ` Cyril Hrubis
2016-11-22 6:50 ` Cyril Hrubis
2016-11-22 7:54 ` Jan Stancek
2016-11-22 8:02 ` Cyril Hrubis
2016-11-22 10:47 ` Jan Stancek
2016-11-22 11:21 ` Cyril Hrubis
-- strict thread matches above, loose matches on Subject: below --
2016-11-22 12:20 Jan Stancek
2016-11-22 13:27 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484818671.202716.1475571733691.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox