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 V3 08/10] syscalls/move_mount: New tests
Date: Wed, 26 Feb 2020 08:47:29 +0100	[thread overview]
Message-ID: <20200226074729.GA15207@dell5510> (raw)
In-Reply-To: <20200226022758.ls35mblsetg4nk6f@vireshk-i7>

Hi Viresh,

> On 25-02-20, 14:57, Petr Vorel wrote:
> > > +	TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
> > > +	if (TST_RET == -1) {
> > > +		SAFE_CLOSE(fd);
> > > +		tst_res(TBROK | TERRNO, "fsconfig() failed");
> > These should be TFAIL otherwise it 1) breaks all tests 2) does not report any
> > result:

> > move_mount02.c:37: BROK: fsopen() failed: SUCCESS (0)
> > tst_test.c:1051: BROK: Test 0 haven't reported results!

> I am a bit confused about TBROK and TFAIL to be honest. The test
> writing guideline says this:

> | 'TFAIL' | Test has failed.
> | 'TBROK' | Something has failed in test preparation phase.

> And so in my code I have been using TFAIL only for the failures for the
> actual syscalls that we are testing, like move_mount here. And I have
> been using TBROK for pretty much everything else.
Your idea is correct, but IMHO it's not good to skip all the tests, which is
done due
tst_test.c:1051: BROK: Test 0 haven't reported results!
if you use tst_res(TBROK ...).

You can use tst_brk(TBROK) to avoid no reported results, but that's obviously
exit the test either.

tst_brk(TBROK) is used for setup, where you create some resource, which is then
reused by all test runs, but this preparation fails.

NOTE: There are some tests which are using tst_res(TBROK). At least some of them are
wrong. IMHO in testcases/kernel/syscalls/request_key/request_key04.c
	TST_ERR = saved_errno;
	if (TST_ERR == EACCES) {
		tst_res(TPASS, "request_key() failed with EACCES as expected");
	} else {
		tst_res(TBROK | TTERRNO,
			"request_key() failed with unexpected error code");
	}

IMHO it should be
	TST_ERR = saved_errno;
	if (TST_ERR == EACCES) {
		tst_res(TPASS, "request_key() failed with EACCES as expected");
	} else {
		tst_res(TFAIL | TTERRNO,
			"request_key() failed with unexpected error code");
	}
Otherwise if it fails at unexpected error code, you get:
request_key04.c:68: BROK: request_key() failed with unexpected error code: EACCES (13)
tst_test.c:1036: BROK: Test haven't reported results!

Thus I'd try to avoid TBROK with tst_res().

> Would be good if you and Cyril can explain what's the correct usage
> model for these is.

Kind regards,
Petr

  parent reply	other threads:[~2020-02-26  7:47 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25  6:40 [LTP] [PATCH V3 00/10] Add new LTP tests related to fsmount family of syscalls Viresh Kumar
2020-02-25  6:40 ` [LTP] [PATCH V3 01/10] tst_device: Add tst_ismount() helper Viresh Kumar
2020-02-25 10:39   ` [LTP] [PATCH V4 1/10] tst_device: Add tst_is_mounted() helper Viresh Kumar
2020-02-26  5:14     ` Zorro Lang
2020-02-26  5:58       ` Yang Xu
2020-02-26  6:28       ` Viresh Kumar
2020-02-25  6:40 ` [LTP] [PATCH V3 02/10] lapi/fsmount.h: Add fsopen_supported_by_kernel() Viresh Kumar
2020-02-26  5:51   ` Zorro Lang
2020-02-25  6:40 ` [LTP] [PATCH V3 03/10] lapi/fsmount.h: Include "lapi/fcntl.h" Viresh Kumar
2020-02-26  5:51   ` Zorro Lang
2020-02-25  6:40 ` [LTP] [PATCH V3 04/10] syscalls/fsopen: New tests Viresh Kumar
2020-02-25  6:40 ` [LTP] [PATCH V3 05/10] syscalls/fsconfig: " Viresh Kumar
2020-02-25 13:46   ` Petr Vorel
2020-02-27  4:54     ` Viresh Kumar
2020-02-25  6:40 ` [LTP] [PATCH V3 06/10] syscalls/fsmount: Improve fsmount01 test Viresh Kumar
2020-02-25  6:40 ` [LTP] [PATCH V3 07/10] syscalls/fsmount: Add failure tests Viresh Kumar
2020-02-25  6:40 ` [LTP] [PATCH V3 08/10] syscalls/move_mount: New tests Viresh Kumar
2020-02-25 13:57   ` Petr Vorel
2020-02-26  2:27     ` Viresh Kumar
2020-02-26  3:34       ` Yang Xu
2020-02-26  4:34         ` Viresh Kumar
2020-02-26  7:47       ` Petr Vorel [this message]
2020-02-26  8:23         ` Viresh Kumar
2020-02-26  8:53           ` Petr Vorel
2020-02-26  8:59             ` Viresh Kumar
2020-02-26  9:20               ` Petr Vorel
2020-02-25  6:40 ` [LTP] [PATCH V3 09/10] syscalls/fspick: " Viresh Kumar
2020-02-25  6:40 ` [LTP] [PATCH V3 10/10] syscalls/open_tree: " Viresh Kumar
2020-02-25 14:25   ` Petr Vorel
2020-02-25 10:00 ` [LTP] [PATCH V3 00/10] Add new LTP tests related to fsmount family of syscalls Li Wang
2020-02-25 10:32   ` Petr Vorel
2020-02-25 10:48   ` Viresh Kumar
2020-02-25 14:23 ` Petr Vorel

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=20200226074729.GA15207@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