* [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID
@ 2025-10-01 14:56 Jan Kara
2025-10-02 9:49 ` Amir Goldstein
2025-10-20 14:16 ` Petr Vorel
0 siblings, 2 replies; 7+ messages in thread
From: Jan Kara @ 2025-10-01 14:56 UTC (permalink / raw)
To: ltp; +Cc: Jan Kara
Add a few testcases verifying AT_HANDLE_FID flag.
Signed-off-by: Jan Kara <jack@suse.cz>
---
include/lapi/fcntl.h | 4 +
.../name_to_handle_at/name_to_handle_at03.c | 88 +++++++++++++++++++
2 files changed, 92 insertions(+)
create mode 100644 testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
This is actually a testcase for a kernel regression, the kernel fix is on the
way.
diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
index 7c050248892e..55a5e8b40432 100644
--- a/include/lapi/fcntl.h
+++ b/include/lapi/fcntl.h
@@ -98,6 +98,10 @@
# define AT_HANDLE_FID AT_REMOVEDIR
#endif
+#ifndef AT_HANDLE_CONNECTABLE
+# define AT_HANDLE_CONNECTABLE 0x002
+#endif
+
#ifndef AT_SYMLINK_FOLLOW
# define AT_SYMLINK_FOLLOW 0x400
#endif
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
new file mode 100644
index 000000000000..4a6df5e46fd7
--- /dev/null
+++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
+ */
+
+/*\
+ * Basic name_to_handle_at() tests.
+ *
+ * [Algorithm]
+ * - Check that EOVERFLOW is returned as expected by name_to_handle_at().
+ * - Check that we were able to access a file's stat with name_to_handle_at()
+ * and open_by_handle_at().
+ */
+
+#define _GNU_SOURCE
+#include <sys/stat.h>
+#include "lapi/name_to_handle_at.h"
+
+#define TEST_FILE "test_file"
+
+static int fd_atcwd = AT_FDCWD;
+static struct file_handle *fhp;
+
+static struct tcase {
+ const char *name;
+ int *dfd;
+ const char *pathname;
+ int name_flags;
+ int exp_errno;
+} tcases[] = {
+ {"test-file", &fd_atcwd, TEST_FILE, AT_HANDLE_FID, 0},
+ {"unexportable-file", &fd_atcwd, "/proc/filesystems", AT_HANDLE_FID, 0},
+ {"test-file-connectable", &fd_atcwd, TEST_FILE, AT_HANDLE_FID | AT_HANDLE_CONNECTABLE, EINVAL},
+};
+
+static bool handle_type_supported(unsigned int flag, const char *name)
+{
+ if (name_to_handle_at(-1, ".", NULL, NULL, flag) && errno == EINVAL) {
+ tst_brk(TCONF, "%s not supported by the kernel.", name);
+ return false;
+ }
+ return true;
+}
+
+#define REQUIRE_HANDLE_TYPE_SUPPORT(flag) handle_type_supported(flag, #flag)
+
+static void setup(void)
+{
+ SAFE_TOUCH(TEST_FILE, 0600, NULL);
+ fhp = malloc(MAX_HANDLE_SZ);
+ if (!fhp)
+ tst_brk(TBROK, "malloc failed");
+
+ REQUIRE_HANDLE_TYPE_SUPPORT(AT_HANDLE_FID);
+ REQUIRE_HANDLE_TYPE_SUPPORT(AT_HANDLE_CONNECTABLE);
+}
+
+static void run(unsigned int n)
+{
+ struct tcase *tc = &tcases[n];
+ int mount_id;
+
+ fhp->handle_bytes = MAX_HANDLE_SZ;
+ TEST(name_to_handle_at(*tc->dfd, tc->pathname, fhp, &mount_id,
+ tc->name_flags));
+ if (!tc->exp_errno) {
+ if (TST_RET)
+ tst_res(TFAIL | TTERRNO, "%s: name_to_handle_at() failed", tc->name);
+ else
+ tst_res(TPASS, "%s: name_to_handle_at() passed", tc->name);
+ return;
+ }
+
+ if (TST_RET != -1)
+ tst_res(TFAIL, "%s: name_to_handle_at() unexpectedly succeeded", tc->name);
+ else if (TST_ERR != tc->exp_errno)
+ tst_res(TFAIL | TTERRNO, "%s: name_to_handle_at() should fail with errno %s",
+ tc->name, tst_strerrno(tc->exp_errno));
+ else
+ tst_res(TPASS, "%s: name_to_handle_at() failed as expected", tc->name);
+}
+
+static struct tst_test test = {
+ .tcnt = ARRAY_SIZE(tcases),
+ .test = run,
+ .setup = setup,
+ .needs_tmpdir = 1,
+};
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID
2025-10-01 14:56 [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID Jan Kara
@ 2025-10-02 9:49 ` Amir Goldstein
2025-10-03 16:26 ` Jan Kara
2025-10-20 14:16 ` Petr Vorel
1 sibling, 1 reply; 7+ messages in thread
From: Amir Goldstein @ 2025-10-02 9:49 UTC (permalink / raw)
To: Jan Kara; +Cc: ltp
On Wed, Oct 1, 2025 at 4:56 PM Jan Kara <jack@suse.cz> wrote:
>
> Add a few testcases verifying AT_HANDLE_FID flag.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> include/lapi/fcntl.h | 4 +
> .../name_to_handle_at/name_to_handle_at03.c | 88 +++++++++++++++++++
> 2 files changed, 92 insertions(+)
> create mode 100644 testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
>
> This is actually a testcase for a kernel regression, the kernel fix is on the
> way.
Best that we wait for fix to land before merging the test so that we can
add linux-git tag to the test (or can add it later)
With minor nits below fixed, feel free to add:
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Thanks for covering my test debt!!
Amir.
>
> diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
> index 7c050248892e..55a5e8b40432 100644
> --- a/include/lapi/fcntl.h
> +++ b/include/lapi/fcntl.h
> @@ -98,6 +98,10 @@
> # define AT_HANDLE_FID AT_REMOVEDIR
> #endif
>
> +#ifndef AT_HANDLE_CONNECTABLE
> +# define AT_HANDLE_CONNECTABLE 0x002
> +#endif
> +
> #ifndef AT_SYMLINK_FOLLOW
> # define AT_SYMLINK_FOLLOW 0x400
> #endif
> diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
> new file mode 100644
> index 000000000000..4a6df5e46fd7
> --- /dev/null
> +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
> @@ -0,0 +1,88 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
> + */
> +
> +/*\
> + * Basic name_to_handle_at() tests.
> + *
> + * [Algorithm]
> + * - Check that EOVERFLOW is returned as expected by name_to_handle_at().
> + * - Check that we were able to access a file's stat with name_to_handle_at()
> + * and open_by_handle_at().
stale description
> + */
> +
> +#define _GNU_SOURCE
> +#include <sys/stat.h>
> +#include "lapi/name_to_handle_at.h"
> +
> +#define TEST_FILE "test_file"
> +
> +static int fd_atcwd = AT_FDCWD;
> +static struct file_handle *fhp;
> +
> +static struct tcase {
> + const char *name;
> + int *dfd;
> + const char *pathname;
> + int name_flags;
> + int exp_errno;
> +} tcases[] = {
> + {"test-file", &fd_atcwd, TEST_FILE, AT_HANDLE_FID, 0},
> + {"unexportable-file", &fd_atcwd, "/proc/filesystems", AT_HANDLE_FID, 0},
> + {"test-file-connectable", &fd_atcwd, TEST_FILE, AT_HANDLE_FID | AT_HANDLE_CONNECTABLE, EINVAL},
> +};
> +
> +static bool handle_type_supported(unsigned int flag, const char *name)
> +{
> + if (name_to_handle_at(-1, ".", NULL, NULL, flag) && errno == EINVAL) {
explain that -1 would fail with EBADF if flags are supported?
> + tst_brk(TCONF, "%s not supported by the kernel.", name);
> + return false;
> + }
> + return true;
> +}
> +
> +#define REQUIRE_HANDLE_TYPE_SUPPORT(flag) handle_type_supported(flag, #flag)
> +
> +static void setup(void)
> +{
> + SAFE_TOUCH(TEST_FILE, 0600, NULL);
> + fhp = malloc(MAX_HANDLE_SZ);
> + if (!fhp)
> + tst_brk(TBROK, "malloc failed");
> +
> + REQUIRE_HANDLE_TYPE_SUPPORT(AT_HANDLE_FID);
> + REQUIRE_HANDLE_TYPE_SUPPORT(AT_HANDLE_CONNECTABLE);
> +}
> +
> +static void run(unsigned int n)
> +{
> + struct tcase *tc = &tcases[n];
> + int mount_id;
> +
> + fhp->handle_bytes = MAX_HANDLE_SZ;
> + TEST(name_to_handle_at(*tc->dfd, tc->pathname, fhp, &mount_id,
> + tc->name_flags));
> + if (!tc->exp_errno) {
> + if (TST_RET)
> + tst_res(TFAIL | TTERRNO, "%s: name_to_handle_at() failed", tc->name);
> + else
> + tst_res(TPASS, "%s: name_to_handle_at() passed", tc->name);
> + return;
> + }
> +
> + if (TST_RET != -1)
> + tst_res(TFAIL, "%s: name_to_handle_at() unexpectedly succeeded", tc->name);
> + else if (TST_ERR != tc->exp_errno)
> + tst_res(TFAIL | TTERRNO, "%s: name_to_handle_at() should fail with errno %s",
> + tc->name, tst_strerrno(tc->exp_errno));
> + else
> + tst_res(TPASS, "%s: name_to_handle_at() failed as expected", tc->name);
> +}
> +
> +static struct tst_test test = {
> + .tcnt = ARRAY_SIZE(tcases),
> + .test = run,
> + .setup = setup,
> + .needs_tmpdir = 1,
> +};
> --
> 2.51.0
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID
2025-10-02 9:49 ` Amir Goldstein
@ 2025-10-03 16:26 ` Jan Kara
0 siblings, 0 replies; 7+ messages in thread
From: Jan Kara @ 2025-10-03 16:26 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Jan Kara, ltp
On Thu 02-10-25 11:49:28, Amir Goldstein wrote:
> On Wed, Oct 1, 2025 at 4:56 PM Jan Kara <jack@suse.cz> wrote:
> >
> > Add a few testcases verifying AT_HANDLE_FID flag.
> >
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> > include/lapi/fcntl.h | 4 +
> > .../name_to_handle_at/name_to_handle_at03.c | 88 +++++++++++++++++++
> > 2 files changed, 92 insertions(+)
> > create mode 100644 testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
> >
> > This is actually a testcase for a kernel regression, the kernel fix is on the
> > way.
>
> Best that we wait for fix to land before merging the test so that we can
> add linux-git tag to the test (or can add it later)
Yes, I was intending to do that but wanted to send out the test for review
before that...
> With minor nits below fixed, feel free to add:
> Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Thanks, nits fixed up. I'll send v2 once the kernel fix is merged.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID
2025-10-01 14:56 [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID Jan Kara
2025-10-02 9:49 ` Amir Goldstein
@ 2025-10-20 14:16 ` Petr Vorel
2025-10-20 16:30 ` Jan Kara
1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2025-10-20 14:16 UTC (permalink / raw)
To: Jan Kara; +Cc: ltp
Hi Jan,
> Add a few testcases verifying AT_HANDLE_FID flag.
Thanks for keeping tests updated, we really appreciate that.
I wonder if the functionality got merged.
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> include/lapi/fcntl.h | 4 +
> .../name_to_handle_at/name_to_handle_at03.c | 88 +++++++++++++++++++
> 2 files changed, 92 insertions(+)
> create mode 100644 testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
> This is actually a testcase for a kernel regression, the kernel fix is on the
> way.
> diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
> index 7c050248892e..55a5e8b40432 100644
> --- a/include/lapi/fcntl.h
> +++ b/include/lapi/fcntl.h
> @@ -98,6 +98,10 @@
> # define AT_HANDLE_FID AT_REMOVEDIR
> #endif
> +#ifndef AT_HANDLE_CONNECTABLE
> +# define AT_HANDLE_CONNECTABLE 0x002
> +#endif
> +
> #ifndef AT_SYMLINK_FOLLOW
> # define AT_SYMLINK_FOLLOW 0x400
> #endif
> diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
> new file mode 100644
> index 000000000000..4a6df5e46fd7
> --- /dev/null
> +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
> @@ -0,0 +1,88 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
> + */
> +
> +/*\
> + * Basic name_to_handle_at() tests.
> + *
> + * [Algorithm]
nit: unrelated to the test subject. Here needs to be a blank line, otherwise
following lines aren't recognised as list, but they remain inline (RST format
used for spinx).
> + * - Check that EOVERFLOW is returned as expected by name_to_handle_at().
> + * - Check that we were able to access a file's stat with name_to_handle_at()
> + * and open_by_handle_at().
> + */
> +
> +#define _GNU_SOURCE
> +#include <sys/stat.h>
> +#include "lapi/name_to_handle_at.h"
> +
> +#define TEST_FILE "test_file"
> +
> +static int fd_atcwd = AT_FDCWD;
> +static struct file_handle *fhp;
> +
> +static struct tcase {
> + const char *name;
> + int *dfd;
> + const char *pathname;
> + int name_flags;
> + int exp_errno;
> +} tcases[] = {
> + {"test-file", &fd_atcwd, TEST_FILE, AT_HANDLE_FID, 0},
> + {"unexportable-file", &fd_atcwd, "/proc/filesystems", AT_HANDLE_FID, 0},
> + {"test-file-connectable", &fd_atcwd, TEST_FILE, AT_HANDLE_FID | AT_HANDLE_CONNECTABLE, EINVAL},
> +};
> +
> +static bool handle_type_supported(unsigned int flag, const char *name)
> +{
> + if (name_to_handle_at(-1, ".", NULL, NULL, flag) && errno == EINVAL) {
> + tst_brk(TCONF, "%s not supported by the kernel.", name);
> + return false;
> + }
> + return true;
> +}
> +
> +#define REQUIRE_HANDLE_TYPE_SUPPORT(flag) handle_type_supported(flag, #flag)
> +
> +static void setup(void)
> +{
> + SAFE_TOUCH(TEST_FILE, 0600, NULL);
> + fhp = malloc(MAX_HANDLE_SZ);
> + if (!fhp)
> + tst_brk(TBROK, "malloc failed");
> +
> + REQUIRE_HANDLE_TYPE_SUPPORT(AT_HANDLE_FID);
> + REQUIRE_HANDLE_TYPE_SUPPORT(AT_HANDLE_CONNECTABLE);
> +}
> +
> +static void run(unsigned int n)
> +{
> + struct tcase *tc = &tcases[n];
> + int mount_id;
> +
> + fhp->handle_bytes = MAX_HANDLE_SZ;
> + TEST(name_to_handle_at(*tc->dfd, tc->pathname, fhp, &mount_id,
> + tc->name_flags));
> + if (!tc->exp_errno) {
> + if (TST_RET)
> + tst_res(TFAIL | TTERRNO, "%s: name_to_handle_at() failed", tc->name);
> + else
> + tst_res(TPASS, "%s: name_to_handle_at() passed", tc->name);
> + return;
nit: We have TST_EXP_PASS() ...
> + }
> +
> + if (TST_RET != -1)
> + tst_res(TFAIL, "%s: name_to_handle_at() unexpectedly succeeded", tc->name);
> + else if (TST_ERR != tc->exp_errno)
> + tst_res(TFAIL | TTERRNO, "%s: name_to_handle_at() should fail with errno %s",
> + tc->name, tst_strerrno(tc->exp_errno));
> + else
> + tst_res(TPASS, "%s: name_to_handle_at() failed as expected", tc->name);
... and TST_EXP_FAIL() to simplify. Something like should work (untested):
if (!tc->exp_errno) {
TST_EXP_PASS(name_to_handle_at(*tc->dfd, tc->pathname, fhp, &mount_id,
tc->name_flags));
return;
} else {
TST_EXP_FAIL(name_to_handle_at(*tc->dfd, tc->pathname, fhp, &mount_id,
tc->name_flags), tc->exp_errno);
}
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID
2025-10-20 14:16 ` Petr Vorel
@ 2025-10-20 16:30 ` Jan Kara
0 siblings, 0 replies; 7+ messages in thread
From: Jan Kara @ 2025-10-20 16:30 UTC (permalink / raw)
To: Petr Vorel; +Cc: Jan Kara, ltp
On Mon 20-10-25 16:16:43, Petr Vorel wrote:
> Hi Jan,
>
> > Add a few testcases verifying AT_HANDLE_FID flag.
>
> Thanks for keeping tests updated, we really appreciate that.
> I wonder if the functionality got merged.
Not yet (due to my screwup with email). It should be merged later this week
at which point I'll resend the LTP patch with fixups Amir suggested and
proper kernel commit.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID
@ 2025-10-21 9:58 Jan Kara
2025-10-21 11:23 ` Petr Vorel
0 siblings, 1 reply; 7+ messages in thread
From: Jan Kara @ 2025-10-21 9:58 UTC (permalink / raw)
To: ltp; +Cc: Jan Kara
Add a few testcases verifying AT_HANDLE_FID flag.
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
include/lapi/fcntl.h | 4 +
.../name_to_handle_at/name_to_handle_at03.c | 88 +++++++++++++++++++
2 files changed, 92 insertions(+)
create mode 100644 testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
Changes since v1:
* Added kernel commit fixing the issue
* Fixed up test description
diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
index 7c050248892e..55a5e8b40432 100644
--- a/include/lapi/fcntl.h
+++ b/include/lapi/fcntl.h
@@ -98,6 +98,10 @@
# define AT_HANDLE_FID AT_REMOVEDIR
#endif
+#ifndef AT_HANDLE_CONNECTABLE
+# define AT_HANDLE_CONNECTABLE 0x002
+#endif
+
#ifndef AT_SYMLINK_FOLLOW
# define AT_SYMLINK_FOLLOW 0x400
#endif
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
new file mode 100644
index 000000000000..d1f53c39d1df
--- /dev/null
+++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*\
+ * name_to_handle_at() tests for AT_HANDLE_FID handles.
+ */
+
+#define _GNU_SOURCE
+#include <sys/stat.h>
+#include "lapi/name_to_handle_at.h"
+
+#define TEST_FILE "test_file"
+
+static int fd_atcwd = AT_FDCWD;
+static struct file_handle *fhp;
+
+static struct tcase {
+ const char *name;
+ int *dfd;
+ const char *pathname;
+ int name_flags;
+ int exp_errno;
+} tcases[] = {
+ {"test-file", &fd_atcwd, TEST_FILE, AT_HANDLE_FID, 0},
+ {"unexportable-file", &fd_atcwd, "/proc/filesystems", AT_HANDLE_FID, 0},
+ {"test-file-connectable", &fd_atcwd, TEST_FILE, AT_HANDLE_FID | AT_HANDLE_CONNECTABLE, EINVAL},
+};
+
+static bool handle_type_supported(unsigned int flag, const char *name)
+{
+ /*
+ * For kernels which don't support the flag, name_to_handle_at()
+ * returns EINVAL, otherwise we should get back EBADF because dirfd is
+ * invalid.
+ */
+ if (name_to_handle_at(-1, ".", NULL, NULL, flag) && errno == EINVAL) {
+ tst_brk(TCONF, "%s not supported by the kernel.", name);
+ return false;
+ }
+ return true;
+}
+
+#define REQUIRE_HANDLE_TYPE_SUPPORT(flag) handle_type_supported(flag, #flag)
+
+static void setup(void)
+{
+ SAFE_TOUCH(TEST_FILE, 0600, NULL);
+ fhp = malloc(MAX_HANDLE_SZ);
+ if (!fhp)
+ tst_brk(TBROK, "malloc failed");
+
+ REQUIRE_HANDLE_TYPE_SUPPORT(AT_HANDLE_FID);
+ REQUIRE_HANDLE_TYPE_SUPPORT(AT_HANDLE_CONNECTABLE);
+}
+
+static void run(unsigned int n)
+{
+ struct tcase *tc = &tcases[n];
+ int mount_id;
+
+ fhp->handle_bytes = MAX_HANDLE_SZ;
+ TEST(name_to_handle_at(*tc->dfd, tc->pathname, fhp, &mount_id,
+ tc->name_flags));
+ if (!tc->exp_errno) {
+ if (TST_RET)
+ tst_res(TFAIL | TTERRNO, "%s: name_to_handle_at() failed", tc->name);
+ else
+ tst_res(TPASS, "%s: name_to_handle_at() passed", tc->name);
+ return;
+ }
+
+ if (TST_RET != -1)
+ tst_res(TFAIL, "%s: name_to_handle_at() unexpectedly succeeded", tc->name);
+ else if (TST_ERR != tc->exp_errno)
+ tst_res(TFAIL | TTERRNO, "%s: name_to_handle_at() should fail with errno %s",
+ tc->name, tst_strerrno(tc->exp_errno));
+ else
+ tst_res(TPASS, "%s: name_to_handle_at() failed as expected", tc->name);
+}
+
+static struct tst_test test = {
+ .tcnt = ARRAY_SIZE(tcases),
+ .test = run,
+ .setup = setup,
+ .needs_tmpdir = 1,
+ .tags = (const struct tst_tag[]) {
+ {"linux-git", "48b77733d0db"},
+ {}
+ },
+};
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID
2025-10-21 9:58 Jan Kara
@ 2025-10-21 11:23 ` Petr Vorel
0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2025-10-21 11:23 UTC (permalink / raw)
To: Jan Kara; +Cc: ltp
Hi Jan, Amir,
> Add a few testcases verifying AT_HANDLE_FID flag.
> Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> include/lapi/fcntl.h | 4 +
> .../name_to_handle_at/name_to_handle_at03.c | 88 +++++++++++++++++++
> 2 files changed, 92 insertions(+)
> create mode 100644 testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at03.c
> Changes since v1:
> * Added kernel commit fixing the issue
> * Fixed up test description
Thanks! Merged with added entry to runtest/syscalls and .gitignore.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-10-21 11:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-01 14:56 [LTP] [PATCH] name_to_handle_at: Add test cases for AT_HANDLE_FID Jan Kara
2025-10-02 9:49 ` Amir Goldstein
2025-10-03 16:26 ` Jan Kara
2025-10-20 14:16 ` Petr Vorel
2025-10-20 16:30 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2025-10-21 9:58 Jan Kara
2025-10-21 11:23 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox