keyctl02: make use of .max_runtime
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
Signed-off-by Li Wang <[email protected]>
--- testcases/kernel/syscalls/keyctl/keyctl02.c | 6 ++++++ 1 file changed, 6 insertions(+)
testcases/kernel/syscalls/keyctl/keyctl02.c +6 -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); +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
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:
Reviewed-by Cyril Hrubis <[email protected]>
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
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 %ilooping 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