public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] tst_test.sh: Fix calling not yet loaded cleanup function
Date: Tue, 19 May 2020 08:37:40 +0200	[thread overview]
Message-ID: <20200519063740.GA7756@dell5510> (raw)
In-Reply-To: <1a41aca6-f774-08da-bf7b-b33806b48923@jv-coder.de>

Hi J?rg,

> >   	TST_DO_EXIT=1
> > -	if [ -n "$TST_CLEANUP" -a -z "$TST_NO_CLEANUP" ]; then
> > +	if [ -n "$TST_SETUP_STARTED" -a -n "$TST_RUN_STARTED" -a \
> > +		-n "$TST_CLEANUP" -a -z "$TST_NO_CLEANUP" ]; then
> In the description you write "[after] running either setup or test
> function". But this implementation
> is "after running setup and test function". Cleanup should also be executed,
> if only setup was run right?
Thanks! Yes, I meant -o (or), but typed -a (and).

> > @@ -592,9 +594,11 @@ tst_run()
> >   			_tst_max=$(( $(echo $TST_TEST_DATA | tr -cd "$TST_TEST_DATA_IFS" | wc -c) +1))
> >   			for _tst_i in $(seq $_tst_max); do
> >   				_tst_data="$(echo "$TST_TEST_DATA" | cut -d"$TST_TEST_DATA_IFS" -f$_tst_i)"
> > +				TST_RUN_STARTED=1
> >   				_tst_run_tests "$_tst_data"
> >   			done
> >   		else
> > +			TST_RUN_STARTED=1
> >   			_tst_run_tests
> >   		fi
> Is it really important, that test is started? Shouldn't it be enough if we
> got to the point, where the test
> could be started. Moving TST_RUN_STARTED out of the condition would reduce
> repetition.

Well, if you look into the code, there is tst_require_cmds call in if clause,
which should pass:

	#TODO check that test reports some results for each test function call
	while [ $TST_ITERATIONS -gt 0 ]; do
		if [ -n "$TST_TEST_DATA" ]; then
			tst_require_cmds cut tr wc
			_tst_max=$(( $(echo $TST_TEST_DATA | tr -cd "$TST_TEST_DATA_IFS" | wc -c) +1))
			for _tst_i in $(seq $_tst_max); do
				_tst_data="$(echo "$TST_TEST_DATA" | cut -d"$TST_TEST_DATA_IFS" -f$_tst_i)"
				TST_RUN_STARTED=1
				_tst_run_tests "$_tst_data"
			done
		else
			TST_RUN_STARTED=1
			_tst_run_tests
		fi
		TST_ITERATIONS=$((TST_ITERATIONS-1))
	done

Kind regards,
Petr

  reply	other threads:[~2020-05-19  6:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 13:01 [LTP] [PATCH 1/2] tst_test.sh: Fix calling not yet loaded cleanup function Petr Vorel
2020-05-18 13:01 ` [LTP] [PATCH 2/2] tst_test.sh: Warn about setup/cleanup function not loaded Petr Vorel
2020-05-19  5:10   ` Joerg Vehlow
2020-05-19  6:43     ` Petr Vorel
2020-05-19  5:05 ` [LTP] [PATCH 1/2] tst_test.sh: Fix calling not yet loaded cleanup function Joerg Vehlow
2020-05-19  6:37   ` Petr Vorel [this message]
2020-05-19  6:44     ` Joerg Vehlow

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=20200519063740.GA7756@dell5510 \
    --to=pvorel@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