All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] keyctl02: make use of .max_runtime
@ 2022-11-18  6:57 Li Wang
  2022-11-18 13:39 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2022-11-18  6:57 UTC (permalink / raw)
  To: ltp

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 <liwang@redhat.com>
---
 testcases/kernel/syscalls/keyctl/keyctl02.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/testcases/kernel/syscalls/keyctl/keyctl02.c b/testcases/kernel/syscalls/keyctl/keyctl02.c
index f4ee03f33..467943fec 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl02.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl02.c
@@ -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"},
-- 
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] keyctl02: make use of .max_runtime
  2022-11-18  6:57 [LTP] [PATCH] keyctl02: make use of .max_runtime Li Wang
@ 2022-11-18 13:39 ` Cyril Hrubis
  2022-11-19  2:02   ` Li Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2022-11-18 13:39 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi!
> --- a/testcases/kernel/syscalls/keyctl/keyctl02.c
> +++ b/testcases/kernel/syscalls/keyctl/keyctl02.c
> @@ -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"
> +			break;
> +		}
>  	}

Other than that:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] keyctl02: make use of .max_runtime
  2022-11-18 13:39 ` Cyril Hrubis
@ 2022-11-19  2:02   ` Li Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Li Wang @ 2022-11-19  2:02 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp


[-- Attachment #1.1: Type: text/plain, Size: 979 bytes --]

On Fri, Nov 18, 2022 at 9:38 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > --- a/testcases/kernel/syscalls/keyctl/keyctl02.c
> > +++ b/testcases/kernel/syscalls/keyctl/keyctl02.c
> > @@ -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"
>

Sounds good, merged this modification.

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 1811 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-19  2:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-18  6:57 [LTP] [PATCH] keyctl02: make use of .max_runtime Li Wang
2022-11-18 13:39 ` Cyril Hrubis
2022-11-19  2:02   ` Li Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.