[RFC PATCH 1/5] landlock/selftests: add a missing close(srv_fd) call
Günther Noack
gnoack3000 at gmail.com
Sat Jan 10 10:37:20 UTC 2026
On Fri, Jan 09, 2026 at 11:49:48AM +0100, Mickaël Salaün wrote:
> On Fri, Jan 09, 2026 at 11:41:30AM +0100, Mickaël Salaün wrote:
> > Good, I'll pick that in my -next branch.
> >
> > Nit: The prefix should be "selftests/landlock"
> >
> > On Thu, Jan 01, 2026 at 02:40:58PM +0100, Günther Noack wrote:
> > > Signed-off-by: Günther Noack <gnoack3000 at gmail.com>
> > > ---
> > > tools/testing/selftests/landlock/fs_test.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c
> > > index 37a5a3df712ec..16503f2e6a481 100644
> > > --- a/tools/testing/selftests/landlock/fs_test.c
> > > +++ b/tools/testing/selftests/landlock/fs_test.c
> > > @@ -4400,6 +4400,7 @@ TEST_F_FORK(layout1, named_unix_domain_socket_ioctl)
> > > EXPECT_EQ(0, test_fionread_ioctl(cli_fd));
> > >
> > > ASSERT_EQ(0, close(cli_fd));
> > > + ASSERT_EQ(0, close(srv_fd));
>
> I'll also replace these ASSERT_EQ() with EXPECT_EQ().
Fair enough. I would normally prefer ASSERT here, because that would
be more symmetric with the corresponding setup steps, but it feels not
worth bikeshedding over this.
The selftests, both Landlock and others, are inconsistent in how they
use ASSERT and EXPECT, especially for close(). I wish we had an
easier way to do state teardown in the selftests without having to tie
it to a FIXTURE()...
–Günther
More information about the Linux-security-module-archive
mailing list