From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC PATCH v3 1/2] tst_test.sh: Add TST_TEST_DATA and TST_TEST_DATA_IFS
Date: Thu, 24 May 2018 16:00:58 +0200 [thread overview]
Message-ID: <20180524140058.GD20945@rei> (raw)
In-Reply-To: <20180524135327.q5bs2uydjrygaeoq@dell5510>
Hi!
> > Actually this is a good idea, we can follow the python underscore
> > notation that uses it for private variables and functions. Hence the
> > counters will become _tst_i, etc.
>
> > But please do that in a separate patch.
> I meant to add underscore before new functions i.e. _tst_run_tests() and _tst_run_test().
> Variables: do you mean to change local variables in tst_run()?
> That would be really for separate patch.
As I written, change everything private that leaks to the test context
with _tst_ so that it's clear what the test is supposed to set/call.
> > > ---
> > > doc/test-writing-guidelines.txt | 74 +++++++++++++++++++++++++++++++++++++----
> > > testcases/lib/tst_test.sh | 61 +++++++++++++++++++++------------
> > > 2 files changed, 106 insertions(+), 29 deletions(-)
>
> ...
> > > +TST_TESTFUNC=do_test
> > > +TST_CNT=2
> > > +TST_TEST_DATA="foo:bar:d dd"
> > > +. tst_test.sh
> > > +
> > > +do_test()
> > > +{
> > > + case $1 in
> > > + 1) tst_res TPASS "Test $1 passed with data '$2'";;
> > > + 2) tst_res TPASS "Test $1 passed with data '$2'";;
> > > + esac
> > > +}
> > > +
> > > +tst_run
> > > +# output:
> > > +# test 1 TPASS: Test 1 passed with data 'foo:bar:d'
> > > +# test 2 TPASS: Test 2 passed with data 'foo:bar:d'
> > > +
> > > +-------------------------------------------------------------------------------
> > > +When '$TST_TEST_DATA' is used with '$TST_CNT', it's passed as whole string in
> > > +'$2' ($1 is for the test number), '$TST_TEST_DATA_IFS' is ignored. Similar
> > > +would be when using these variables with separate functions.
>
> > Now that we support both TST_CNT and TST_TEST_DATA_IFS can we change
> > this example to include the TST_TEST_DATA_IFS=":" as well?
> I wanted to demonstrate that TST_TEST_DATA_IFS has a default value ' ').
> But ok, I'll change it to define TST_TEST_DATA_IFS as well.
No problem with that, but then we should get rid of the : from the
example data and keep it only at "foo bar".
> > Can we please prefix the res here with tst_ as well since we are
> > touching the code?
> Sure. To be honest I wasn't sure whether there is some reason for $res being named without
> prefix or not.
I guess that it haven't been caught in the review process when I first
wrote the library...
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2018-05-24 14:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-22 19:34 [LTP] [RFC PATCH v3 1/2] tst_test.sh: Add TST_TEST_DATA and TST_TEST_DATA_IFS Petr Vorel
2018-05-22 19:34 ` [LTP] [RFC PATCH v3 2/2] lib: Add tests Petr Vorel
2018-05-24 13:46 ` Cyril Hrubis
2018-05-24 14:00 ` Petr Vorel
2018-08-28 11:18 ` [LTP] [PATCH 1/2] Make shell lib tests standalone Christian Lanig
2018-08-28 11:18 ` [LTP] [PATCH 2/2] Add wanted output to shell lib test case Christian Lanig
2018-08-29 17:24 ` [LTP] [PATCH 1/2] Make shell lib tests standalone Petr Vorel
2018-08-29 17:30 ` Petr Vorel
2018-08-31 15:24 ` [LTP] [RFC PATCH 0/1] Add automated tests for shell lib Christian Lanig
2018-08-31 15:24 ` [LTP] [RFC PATCH 1/1] " Christian Lanig
2018-10-03 9:51 ` Cyril Hrubis
2018-10-03 10:46 ` Petr Vorel
2018-10-03 11:32 ` Petr Vorel
2019-08-22 19:12 ` [LTP] [RFC PATCH v2 0/1] " Christian Lanig
2019-08-22 19:12 ` [LTP] [RFC PATCH v2 1/1] " Christian Lanig
2019-09-19 16:41 ` Petr Vorel
2019-09-30 18:27 ` Christian Lanig
2019-09-20 14:21 ` Clemens Famulla-Conrad
2019-09-19 14:26 ` [LTP] [RFC PATCH v2 0/1] " Petr Vorel
2018-08-31 11:46 ` [LTP] [PATCH 1/2] Make shell lib tests standalone Cyril Hrubis
2018-05-24 13:41 ` [LTP] [RFC PATCH v3 1/2] tst_test.sh: Add TST_TEST_DATA and TST_TEST_DATA_IFS Cyril Hrubis
2018-05-24 13:53 ` Petr Vorel
2018-05-24 14:00 ` Cyril Hrubis [this message]
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=20180524140058.GD20945@rei \
--to=chrubis@suse.cz \
--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