ipc/semget05: Fix .save_restore flags
PATCH 1/3 ipc/semget05: Fix .save_restore flags
The test can run without root privileges. Add TST_SR_SKIP_RO to ignore read-only permissions on /proc/sys/kernel/sem.
--- testcases/kernel/syscalls/ipc/semget/semget05.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/ipc/semget/semget05.c +2 -1
@@ -73,7 +73,8 @@ static struct tst_test test = { .cleanup = cleanup, .test_all = verify_semget, .save_restore = (const struct tst_path_val []){ - {"/proc/sys/kernel/sem" ,NULL ,TST_SR_TCONF }, + {"/proc/sys/kernel/sem" ,NULL , +TST_SR_TCONF_MISSING |TST_SR_SKIP_RO }, {} } };
Signature · 5 lines
2.40.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/3 ipc/semget05: Set dynamic run time
The semget() syscall can be slow on some archs so too high default system limit may cause timeouts. Set dynamic run time based on semaphore limit.
---
I've originally tried to create an IPC namespace and set low custom limit but IPC namespaces don't allow unprivileged users to reconfigure them like the network namespaces do. This is the second best solution.
testcases/kernel/syscalls/ipc/semget/semget05.c | 3 +++ 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/ipc/semget/semget05.c +3 -0
@@ -42,6 +42,9 @@ static void setup(void) used_cnt);SAFE_FILE_SCANF ("/proc/sys/kernel/sem" ,"%*d %*d %*d %d" , &maxsems); +/* Prevent timeout due to high semaphore array limit */ +tst_set_max_runtime (maxsems /200 ); + sem_id_arr =SAFE_MALLOC ((maxsems - used_cnt) *sizeof (int ));for (num =0 ; num < maxsems - used_cnt; num++) { res =semget (semkey + num,PSEMS ,IPC_CREAT |IPC_EXCL |SEM_RA );
Signature · 5 lines
2.40.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/3] ipc/semget05: Set dynamic run time
Hi Martin,
Quoted 7 lines
The
semget()syscall can be slow on some archs so too high default system limit may cause timeouts. Set dynamic run time based on semaphore limit.I've originally tried to create an IPC namespace and set low custom limit but IPC namespaces don't allow unprivileged users to reconfigure them like the network namespaces do. This is the second best solution.
IMHO good enough.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 3/3 doc: Fix typo in max_runtime docs
In reply to Martin Doucha--- doc/c-test-api.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
doc/c-test-api.txt +1 -1
@@ -102,7 +102,7 @@ that should cover the duration of test setup and cleanup plus some safety. Any test that runs for more than a second or two has to make sure to: - set the runtime either by setting the '.max_runtime' in tst_test or by - calling 'tst_set_runtime()' in the test setup + calling 'tst_set_max_runtime()' in the test setup - monitor remaning runtime by regular calls to 'tst_remaining_runtime()' and exit when runtime has been used up
Signature · 5 lines
2.40.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs
Hi Martin,
I merged this simple fix.
And I'll ask in "LTP release preparations" thread for merging this. Thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs
Hi Petr, Martin
Quoted 4 lines
Hi Martin,
I merged this simple fix.
And I'll ask in "LTP release preparations" thread for merging this.
This patchset is LGTM, I don't see this email and has merged this patchset, sorry.
ps: This patchset is simple change, so I guess it will not affect a lot for "LTP release preparations".
Best Regards
Yang Xu
Quoted 5 lines
Thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Martin,
Quoted 2 lines
The test can run without root privileges. Add
TST_SR_SKIP_ROto ignore read-only permissions on/proc/sys/kernel/sem.
Very good catch, thanks!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp