[LTP] [PATCH] msgget03: Set custom queue limit

Martin Doucha mdoucha@suse.cz
Mon Jul 4 13:45:23 CEST 2022


The runtime limit patchset has reduced default test timeout to 30 seconds
which is not enough for msgget03 on some archs. Set custom queue count
limit to make the test faster.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/syscalls/ipc/msgget/msgget03.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget03.c b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
index 711886e17..2257ae0f9 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget03.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
@@ -41,7 +41,8 @@ static void setup(void)
 	tst_res(TINFO, "Current environment %d message queues are already in use",
 		used_cnt);
 
-	SAFE_FILE_SCANF("/proc/sys/kernel/msgmni", "%i", &maxmsgs);
+	maxmsgs = used_cnt + 32;
+	SAFE_FILE_PRINTF("/proc/sys/kernel/msgmni", "%i", maxmsgs);
 
 	queues = SAFE_MALLOC((maxmsgs - used_cnt) * sizeof(int));
 
@@ -73,5 +74,9 @@ static struct tst_test test = {
 	.needs_tmpdir = 1,
 	.setup = setup,
 	.cleanup = cleanup,
-	.test_all = verify_msgget
+	.test_all = verify_msgget,
+	.save_restore = (const struct tst_path_val[]){
+		{"/proc/sys/kernel/msgmni", NULL},
+		{}
+	}
 };
-- 
2.36.1



More information about the ltp mailing list