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 2/7] syscalls/fsopen: New tests
Date: Wed, 19 Feb 2020 09:50:18 +0100	[thread overview]
Message-ID: <20200219085018.GB21099@dell5510> (raw)
In-Reply-To: <CAEemH2caDii5LcOX7fbOcrJNY9=TL6RfEi6Y0ajybxMKNgw7ag@mail.gmail.com>

Hi,

> On Mon, Feb 17, 2020 at 9:36 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> > ...
> > > > +static struct tst_test test = {
> > > > +       .min_kver = "5.2",


> > > I suggest removing .min_kver check in all of the tests to let they can be
> > > running on many distributions(which backport the features).

> > If we do that we have to explicitely check for ENOSYS errno in each
> > test, quite possibly with a dummy call to the tested syscall in test
> > setup, because once these calls gets libc wrappers we will no longer
> > call the tst_syscall() that checks for it.


> +1 add dummy call to the tested syscall in the setup.
> Agree, thanks for point out this.
Could anybody add it to fsmount/fsmount01.c instead?


If anybody don't mind, I'll rename fsopen02.c to fsopen01.c,
remove .min_kver = "5.2" and replace tst_brk with tst_res + return, and merge it:

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
 *
 * Description:
 * Basic fsopen() failure tests.
 */

#include "tst_test.h"
#include "lapi/fsmount.h"

const char *invalid_fs = "invalid";
const char *valid_fs;

static struct tcase {
	char *name;
	const char **fs;
	unsigned int flags;
	int exp_errno;
} tcases[] = {
	{"invalid-fs", &invalid_fs, 0, ENODEV},
	{"invalid-flags", &valid_fs, 0x10, EINVAL},
};

static void setup(void)
{
	valid_fs = tst_device->fs_type;
}

static void run(unsigned int n)
{
	struct tcase *tc = &tcases[n];

	TEST(fsopen(*tc->fs, tc->flags));

	if (TST_RET != -1) {
		SAFE_CLOSE(TST_RET);
		tst_res(TFAIL, "%s: fsopen() succeeded unexpectedly (index: %d)",
			tc->name, n);
		return;
	}

	if (tc->exp_errno != TST_ERR) {
		tst_res(TFAIL | TTERRNO, "%s: fsopen() should fail with %s",
			tc->name, tst_strerrno(tc->exp_errno));
		return;
	}

	tst_res(TPASS | TTERRNO, "%s: fsopen() failed as expected", tc->name);
}

static struct tst_test test = {
	.tcnt = ARRAY_SIZE(tcases),
	.test = run,
	.setup = setup,
	.needs_root = 1,
	.needs_device = 1,
};

  parent reply	other threads:[~2020-02-19  8:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 11:35 [LTP] [PATCH 0/7] Add new LTP tests related to fsmount family of syscalls Viresh Kumar
2020-02-14 11:35 ` [LTP] [PATCH 1/7] lapi/fsmount: Add definitions for fsmount related syscalls Viresh Kumar
2020-02-16  9:09   ` Li Wang
2020-02-17  8:08     ` Viresh Kumar
2020-02-14 11:35 ` [LTP] [PATCH 2/7] syscalls/fsopen: New tests Viresh Kumar
2020-02-16 10:11   ` Li Wang
2020-02-17  8:09     ` Viresh Kumar
2020-02-17 13:36     ` Cyril Hrubis
2020-02-18  1:15       ` Li Wang
2020-02-18  8:25         ` Viresh Kumar
2020-02-18  9:02           ` Li Wang
2020-02-18  9:08             ` Viresh Kumar
2020-02-19  8:23         ` Petr Vorel
2020-02-19  8:34           ` Viresh Kumar
2020-02-19  8:50         ` Petr Vorel [this message]
2020-02-19  8:51           ` Viresh Kumar
2020-02-14 11:35 ` [LTP] [PATCH 3/7] syscalls/fsconfig: " Viresh Kumar
2020-02-14 11:35 ` [LTP] [PATCH 4/7] syscalls/fsmount: " Viresh Kumar
2020-02-17  8:17   ` Li Wang
2020-02-17  8:29     ` Viresh Kumar
2020-02-17  8:54       ` Li Wang
2020-02-17  9:58         ` Petr Vorel
2020-02-17 10:28           ` Li Wang
2020-02-17 10:37             ` Li Wang
2020-02-17 11:02               ` Petr Vorel
2020-02-17  8:58       ` Petr Vorel
2020-02-14 11:35 ` [LTP] [PATCH 5/7] syscalls/move_mount: " Viresh Kumar
2020-02-14 11:35 ` [LTP] [PATCH 6/7] syscalls/fspick: " Viresh Kumar
2020-02-14 11:35 ` [LTP] [PATCH 7/7] syscalls/open_tree: " Viresh Kumar
2020-02-18  6:19 ` [LTP] [PATCH 0/7] Add new LTP tests related to fsmount family of syscalls Zorro Lang
2020-02-18  6:50   ` Li Wang
2020-02-18  6:58   ` Viresh Kumar

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=20200219085018.GB21099@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