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

zhaogongyi zhaogongyi@huawei.com
Thu Oct 13 09:45:48 CEST 2022


Hi Petr,

It is failed on my system:

sh-4.4$ ./msgget03
tst_test.c:1535: TINFO: Timeout per run is 0h 00m 30s
msgget03.c:42: TINFO: Current environment 0 message queues are already in use
msgget03.c:45: TBROK: Failed to open FILE '/proc/sys/kernel/msgmni' for writing: EACCES (13)

Summary:
passed   0
failed   0
broken   1
skipped  0
warnings 0
tst_sys_conf.c:118: TWARN: Failed to open FILE '/proc/sys/kernel/msgmni'

> > 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