[LTP] [PATCH 2/2] needs_root: Add setting of needs_root

Petr Vorel pvorel@suse.cz
Thu Oct 13 09:41:36 CEST 2022


Hi Zhao,

> Add setting of  needs_root, otherwise run the test without root
> will fail and report EACCESS or EPERM.
...
>  testcases/kernel/syscalls/bind/bind06.c                       | 1 +
>  testcases/kernel/syscalls/cma/process_vm_readv02.c            | 1 +
>  testcases/kernel/syscalls/cma/process_vm_readv03.c            | 1 +
>  testcases/kernel/syscalls/cma/process_vm_writev02.c           | 1 +
>  testcases/kernel/syscalls/copy_file_range/copy_file_range01.c | 1 +
>  testcases/kernel/syscalls/ipc/msgget/msgget03.c               | 1 +
>  testcases/kernel/syscalls/preadv/preadv03.c                   | 1 +
>  testcases/kernel/syscalls/pwritev/pwritev03.c                 | 1 +
>  testcases/kernel/syscalls/sendto/sendto03.c                   | 1 +
>  testcases/kernel/syscalls/setsockopt/setsockopt05.c           | 1 +
>  testcases/kernel/syscalls/setsockopt/setsockopt06.c           | 1 +
>  testcases/kernel/syscalls/setsockopt/setsockopt07.c           | 1 +
>  testcases/kernel/syscalls/setsockopt/setsockopt08.c           | 1 +
>  testcases/kernel/syscalls/setsockopt/setsockopt09.c           | 1 +
>  testcases/kernel/syscalls/swapon/swapon01.c                   | 1 +
>  15 files changed, 15 insertions(+)
...
> +++ b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
> @@ -72,6 +72,7 @@ static void cleanup(void)

>  static struct tst_test test = {
>  	.needs_tmpdir = 1,
> +	.needs_root = 1,
>  	.setup = setup,
>  	.cleanup = cleanup,
>  	.test_all = verify_msgget,

At least this one is working without root:

$ ./testcases/kernel/syscalls/ipc/msgget/msgget03
tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
msgget03.c:41: TINFO: Current environment 0 message queues are already in use
msgget03.c:55: TINFO: The maximum number of message queues (32000) reached
msgget03.c:30: TPASS: msgget(1629588886, 1536) : ENOSPC (28)

Summary:
passed   1
failed   0
broken   0
skipped  0
warnings 0

Kind regards,
Petr


More information about the ltp mailing list