Skip to contentSkip to conversation

keyctl02: make use of .max_runtime

PATCH In review Li Wang 2 participants 3 messages Nov 18, 2022 – Nov 19, 2022

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 keyctl02: make use of .max_runtime

With setting 30 secs for max_runtime. At the same time exit the main LOOP when tst_remaining_time is exhausted.

This fix improves timeout on slower systems:

  # time ./keyctl02
  tst_test.c:1554: TINFO: Timeout per run is 0h 00m 30s
  ...
  keyctl02.c:85: TINFO: debug only: i == 7723
  keyctl02.c:85: TINFO: debug only: i == 7724
  Test timeouted, sending SIGKILL!
  tst_test.c:1607: TINFO: If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1
  tst_test.c:1608: TBROK: Test killed! (timeout?)

Summary:

  passed   0
  failed   0
  broken   1
  skipped  0

warnings 0

real 0m30.046s
user 0m0.245s
sys 0m9.937s

---
 testcases/kernel/syscalls/keyctl/keyctl02.c | 6 ++++++
 1 file changed, 6 insertions(+)
testcases/kernel/syscalls/keyctl/keyctl02.c +6 -0
index f4ee03f33..467943fec 100644
@@ -81,6 +81,11 @@ static void do_test(void)
 		SAFE_PTHREAD_JOIN(pth[1], NULL);
 		SAFE_PTHREAD_JOIN(pth[2], NULL);
 		SAFE_PTHREAD_JOIN(pth[3], NULL);
+
+		if (!tst_remaining_runtime()) {
+			tst_res(TINFO, "Runtime exhausted, exiting at %i looping times", i);
+			break;
+		}
 	}
 
 	/*
@@ -135,6 +140,7 @@ static struct tst_test test = {
 	.needs_root = 1,
 	.setup = setup,
 	.cleanup = cleanup,
+	.max_runtime = 60,
 	.test_all = do_test,
 	.tags = (const struct tst_tag[]) {
 		{"linux-git", "b4a1b4f5047e"},
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi!

testcases/kernel/syscalls/keyctl/keyctl02.c static void do_test(void) · line 86

Quoted 9 lines
testcases/kernel/syscalls/keyctl/keyctl02.c +3 -0
@@ -81,6 +81,11 @@ static void do_test(void)
 		SAFE_PTHREAD_JOIN(pth[1], NULL);
 		SAFE_PTHREAD_JOIN(pth[2], NULL);
 		SAFE_PTHREAD_JOIN(pth[3], NULL);
+
+		if (!tst_remaining_runtime()) {
+			tst_res(TINFO, "Runtime exhausted, exiting at %i looping times", i);

^
maybe it would be better:
"exiting after %i loops"

testcases/kernel/syscalls/keyctl/keyctl02.c static void do_test(void) · line 89

Quoted 3 lines
testcases/kernel/syscalls/keyctl/keyctl02.c +2 -0
+			break;
+		}
 	}

Other than that:

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw
Quoted 16 lines · Cyril Hrubis

Hi!

testcases/kernel/syscalls/keyctl/keyctl02.c static void do_test(void) · line 86

Quoted 9 lines
testcases/kernel/syscalls/keyctl/keyctl02.c +3 -0
@@ -81,6 +81,11 @@ static void do_test(void)
              SAFE_PTHREAD_JOIN(pth[1], NULL);
              SAFE_PTHREAD_JOIN(pth[2], NULL);
              SAFE_PTHREAD_JOIN(pth[3], NULL);
+
+             if (!tst_remaining_runtime()) {
+                     tst_res(TINFO, "Runtime exhausted, exiting at %i
looping times", i);
                                                              ^
                                                              maybe it
                                                              would be
                                                              better:
                                                              "exiting
Quoted 2 lines

after %i loops"

Sounds good, merged this modification.

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp