[LTP] [PATCH v1] mount08.c: SKIP test if selinux is running

Petr Vorel pvorel@suse.cz
Mon Jul 28 12:31:41 CEST 2025


Hi,

> The commit is missing why this has to be done. Please be more verbose
> and explain the reasons in the commit message.

+1, I was going to write the same (remember: often more useful commit message is
not *what* you change, but *why* your did the change).

Also, test under SELinux returns EACCES instead of ENOENT:

mount08.c:32: TFAIL: mount(/proc/130541/fd/4) expected ENOENT: EACCES (13)

Why not keep the test just update errno for SELinux?

In setup:
static int exp_errno = ENOENT;

	if (tst_selinux_enforcing())
		exp_errno = EACCES;

> > Signed-off-by: Wei Gao <wegao@suse.com>
> > ---
> >  testcases/kernel/syscalls/mount/mount08.c | 3 +++
> >  1 file changed, 3 insertions(+)

> > diff --git a/testcases/kernel/syscalls/mount/mount08.c b/testcases/kernel/syscalls/mount/mount08.c
> > index e2824ac55..1f97de182 100644
> > --- a/testcases/kernel/syscalls/mount/mount08.c
> > +++ b/testcases/kernel/syscalls/mount/mount08.c
> > @@ -41,6 +41,9 @@ static void run(void)

> >  static void setup(void)
> >  {
> > +	if (tst_selinux_enforcing())
> > +		tst_brk(TCONF, "SKIP test since selinux is running");
Please don't use upper case. Also SELinux is not "running" but enabled
in enforce mode. If test should be really skip I would use:

	tst_brk(TCONF, "skip test due SELinux enforce");

Kind regards,
Petr


More information about the ltp mailing list