Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>, Li Wang <liwang@redhat.com>,
	Jan Stancek <jstancek@redhat.com>
Cc: ltp@lists.linux.it
Subject: [LTP] [RFC] .all_filesystems imply .needs_root? [was Re: [PATCH] open14: Rewrite to new API]
Date: Tue, 22 Jul 2025 10:03:22 +0200	[thread overview]
Message-ID: <20250722080322.GA19816@pevik> (raw)
In-Reply-To: <64694997-ff37-4a60-80cd-b780616bdf98@suse.com>

Hi all,

...
> > +static struct tst_test test = {
> > +	.setup = setup,
> > +	.test_all = run,
> > +	.cleanup = cleanup,
> > +	.mntpoint = MNTPOINT,
> > +	.all_filesystems = 1
> We need .needs_root if we acquire a device.

We LTP library allows to run test under non-root user with rw permissions to
/dev/loop-control:

tst_device.c:110: TINFO: Not allowed to open /dev/loop-control. Are you root?: EACCES (13)
tst_device.c:149: TINFO: No free devices found
tst_device.c:362: TBROK: Failed to acquire device

In openSUSE that would be to run tests with user which is in disk group.
Although this should theoretically work, root is often required for something
else:

$ open14
...
tst_supported_fs_types.c:49: TINFO: mkfs is not needed for tmpfs
tst_test.c:1938: TINFO: === Testing on ext2 ===
...
open14.c:141: TINFO: Closing temporary files
open14.c:146: TPASS: Multiple files test passed
open14.c:168: TINFO: Testing linked temp files access mode
open14.c:186: TFAIL: Unexpected access mode: 1755 != 7755
open14.c:186: TFAIL: Unexpected access mode: 1755 != 7755
open14.c:186: TFAIL: Unexpected access mode: 1755 != 7755
open14.c:186: TFAIL: Unexpected access mode: 1755 != 7755
open14.c:186: TFAIL: Unexpected access mode: 1755 != 7755

Obviously with root everything works:
...
open14.c:193: TPASS: File access modes are correct

Also I'm not sure if anybody would bother with configuring group for a test
user. I suppose most of testers run LTP under root.

Also, not all tests define needs_device for these tests:

$ git grep -l -e needs_device -e all_filesystems testcases/ | wc -l
121

$ git grep -l needs_root $(git grep -l -e needs_device -e all_filesystems testcases/) | wc -l
108

Therefore I wonder if we should just imply .needs_root on .all_filesystems (and
other flags). Also doc could be tweaked to show .needs_root in the test catalog
for these tests [1].

And there are other flags which effectively enforce root, e.g. .mount_device
(mount() requires CAP_SYS_ADMIN). Here IMHO implying root makes even more sense.

Kind regards,
Petr

[1] https://linux-test-project.readthedocs.io/en/latest/users/test_catalog.html

> > +};
...

> - Andrea

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2025-07-22  8:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-18 16:29 [LTP] [PATCH] open14: Rewrite to new API Martin Doucha
2025-07-21 13:56 ` Andrea Cervesato via ltp
2025-07-21 15:46   ` Martin Doucha
2025-07-22  8:03   ` Petr Vorel [this message]

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=20250722080322.GA19816@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=jstancek@redhat.com \
    --cc=liwang@redhat.com \
    --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