All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] keyctl02: make use of .max_runtime
Date: Fri, 18 Nov 2022 14:57:51 +0800	[thread overview]
Message-ID: <20221118065751.4120847-1-liwang@redhat.com> (raw)

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

             reply	other threads:[~2022-11-18  6:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18  6:57 Li Wang [this message]
2022-11-18 13:39 ` [LTP] [PATCH] keyctl02: make use of .max_runtime Cyril Hrubis
2022-11-19  2:02   ` Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221118065751.4120847-1-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.