Re: [PATCH v4 2/2] selftest: add tests for O_EMPTYPATH

From: Aleksa Sarai

Date: Thu Apr 23 2026 - 02:10:22 EST


On 2026-04-19, Jori Koolstra <jkoolstra@xxxxxxxxx> wrote:
> Add tests for the new O_EMPTYPATH flag of openat(2)/openat2(2).
>
> Also, the current openat2 tests include a helper header file that
> defines the necessary structs and constants to use openat2(2), such as
> struct open_how. This may result in conflicting definitions when the
> system header openat2.h is present as well.
>
> So add openat2.h generated by 'make headers' to the uapi header
> files in ./tools/include and remove the helper file definitions of
> the current openat2 selftests.

These tests were switched recently to use the kselftests harness[1], you
might need to rework these tests and rebase on top of vfs-7.2.msic.

Those patches also fixed the issue you had with a custom openat2.h --
glibc has wrappers for openat2 now so we can just use them directly.

[1]: https://patch.msgid.link/20260401-openat2-selftests-kunit-v2-0-ad153a07da0c@xxxxxxxxxxxx

> Signed-off-by: Jori Koolstra <jkoolstra@xxxxxxxxx>
> ---
> tools/include/uapi/linux/openat2.h | 43 +++++++++++++++
> tools/testing/selftests/openat2/Makefile | 4 +-
> .../selftests/openat2/emptypath_test.c | 55 +++++++++++++++++++
> tools/testing/selftests/openat2/helpers.h | 40 +-------------
> 4 files changed, 103 insertions(+), 39 deletions(-)
> create mode 100644 tools/include/uapi/linux/openat2.h
> create mode 100644 tools/testing/selftests/openat2/emptypath_test.c

--
Aleksa Sarai
https://www.cyphar.com/

Attachment: signature.asc
Description: PGP signature