Linux Test Project
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 03/15] mem/oom: disable timeouts for testcase in demand
Date: Tue, 18 Jul 2017 16:23:00 +0800	[thread overview]
Message-ID: <20170718082312.3946-4-liwang@redhat.com> (raw)
In-Reply-To: <20170718082312.3946-1-liwang@redhat.com>

OOM spend time is depending on amount of RAM+Swap, it's hard to get
a standard to measure how long it takes, so that we cann't setting
tst_test->timeout easily.

In this patch, we add functionality to disable timeouts for these,
i.e. set the .timeout to -1 and change the test library so that the
alarm() is not set in such case.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 lib/tst_test.c                   | 4 ++--
 testcases/kernel/mem/oom/oom01.c | 1 +
 testcases/kernel/mem/oom/oom02.c | 1 +
 testcases/kernel/mem/oom/oom03.c | 1 +
 testcases/kernel/mem/oom/oom04.c | 1 +
 testcases/kernel/mem/oom/oom05.c | 1 +
 6 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 16ea64f..6c67afe 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -917,9 +917,9 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
 	SAFE_SIGNAL(SIGALRM, alarm_handler);
 	SAFE_SIGNAL(SIGUSR1, heartbeat_handler);
 
-	if (tst_test->timeout)
+	if (tst_test->timeout > 0)
 		tst_set_timeout(tst_test->timeout);
-	else
+	else if (tst_test->timeout == 0)
 		tst_set_timeout(300);
 
 	SAFE_SIGNAL(SIGINT, sigint_handler);
diff --git a/testcases/kernel/mem/oom/oom01.c b/testcases/kernel/mem/oom/oom01.c
index 955642c..3d05860 100644
--- a/testcases/kernel/mem/oom/oom01.c
+++ b/testcases/kernel/mem/oom/oom01.c
@@ -61,6 +61,7 @@ static void cleanup(void)
 static struct tst_test test = {
 	.needs_root = 1,
 	.forks_child = 1,
+	.timeout = -1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_oom,
diff --git a/testcases/kernel/mem/oom/oom02.c b/testcases/kernel/mem/oom/oom02.c
index dab8874..3434a34 100644
--- a/testcases/kernel/mem/oom/oom02.c
+++ b/testcases/kernel/mem/oom/oom02.c
@@ -65,6 +65,7 @@ static void cleanup(void)
 static struct tst_test test = {
 	.needs_root = 1,
 	.forks_child = 1,
+	.timeout = -1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_oom,
diff --git a/testcases/kernel/mem/oom/oom03.c b/testcases/kernel/mem/oom/oom03.c
index b384e2b..f883bc0 100644
--- a/testcases/kernel/mem/oom/oom03.c
+++ b/testcases/kernel/mem/oom/oom03.c
@@ -78,6 +78,7 @@ static void cleanup(void)
 static struct tst_test test = {
 	.needs_root = 1,
 	.forks_child = 1,
+	.timeout = -1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_oom,
diff --git a/testcases/kernel/mem/oom/oom04.c b/testcases/kernel/mem/oom/oom04.c
index 8043097..e4e70e2 100644
--- a/testcases/kernel/mem/oom/oom04.c
+++ b/testcases/kernel/mem/oom/oom04.c
@@ -87,6 +87,7 @@ static void cleanup(void)
 static struct tst_test test = {
 	.needs_root = 1,
 	.forks_child = 1,
+	.timeout = -1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_oom,
diff --git a/testcases/kernel/mem/oom/oom05.c b/testcases/kernel/mem/oom/oom05.c
index 600e8d9..d2e631a 100644
--- a/testcases/kernel/mem/oom/oom05.c
+++ b/testcases/kernel/mem/oom/oom05.c
@@ -115,6 +115,7 @@ void cleanup(void)
 static struct tst_test test = {
 	.needs_root = 1,
 	.forks_child = 1,
+	.timeout = -1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_oom,
-- 
2.9.3


  parent reply	other threads:[~2017-07-18  8:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18  8:22 [LTP] [PATCH v3 00/15] Convert LTP mem/testcase to new API Li Wang
2017-07-18  8:22 ` [LTP] [PATCH v3 01/15] mem/lib: convert " Li Wang
2017-07-18  8:22 ` [LTP] [PATCH v3 02/15] mem/oom: " Li Wang
2017-07-18  8:23 ` Li Wang [this message]
2017-07-18  8:23 ` [LTP] [PATCH v3 04/15] mem/ksm: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 05/15] mm/ksm: move the common code to ksm_common.h Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 06/15] mem/thp: convert to new API Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 07/15] mem/hugetlb: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 08/15] mem/hugemmap: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 09/15] mem/hugeshmat: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 10/15] mem/hugeshmctl: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 11/15] mm/hugeshmdt: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 12/15] mem/hugeshmget: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 13/15] mem/cpuset: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 14/15] mem/swapping: " Li Wang
2017-07-18  8:23 ` [LTP] [PATCH v3 15/15] mem/tunable: " Li Wang
2017-08-01 15:04 ` [LTP] [PATCH v3 00/15] Convert LTP mem/testcase " Cyril Hrubis
2017-08-02  4:00   ` 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=20170718082312.3946-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox