From patchwork Tue Aug 28 11:07:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 962816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4205Zs6VKsz9rvt for ; Tue, 28 Aug 2018 21:08:04 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C64243E71BE for ; Tue, 28 Aug 2018 13:08:00 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 58CCD3E6080 for ; Tue, 28 Aug 2018 13:07:57 +0200 (CEST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 747F3600817 for ; Tue, 28 Aug 2018 13:07:57 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6D7C401C968 for ; Tue, 28 Aug 2018 11:07:55 +0000 (UTC) Received: from dustball.brq.redhat.com (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3509E1007091; Tue, 28 Aug 2018 11:07:54 +0000 (UTC) From: Jan Stancek To: ltp@lists.linux.it, liwan@redhat.com Date: Tue, 28 Aug 2018 13:07:50 +0200 Message-Id: <6680bda80c85d424a5219d9f55dc9c5355dc0da1.1535454204.git.jstancek@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 28 Aug 2018 11:07:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 28 Aug 2018 11:07:55 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jstancek@redhat.com' RCPT:'' X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v2 1/2] lib: add tst_get_timeout() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Jan Stancek --- include/tst_test.h | 1 + lib/tst_test.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/tst_test.h b/include/tst_test.h index 98dacf3873ab..f801d276d2e5 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -217,6 +217,7 @@ const char *tst_strsig(int sig); */ const char *tst_strstatus(int status); +unsigned int tst_get_timeout(void); void tst_set_timeout(int timeout); #ifndef TST_NO_DEFAULT_MAIN diff --git a/lib/tst_test.c b/lib/tst_test.c index 2f3d357d2fcc..7bd18205ae7f 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -992,6 +992,11 @@ static void sigint_handler(int sig LTP_ATTRIBUTE_UNUSED) } } +unsigned int tst_get_timeout(void) +{ + return results->timeout; +} + void tst_set_timeout(int timeout) { char *mul = getenv("LTP_TIMEOUT_MUL"); From patchwork Tue Aug 28 11:07:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 962817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4205Zv4LKCz9s1x for ; Tue, 28 Aug 2018 21:08:07 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2B9483E764E for ; Tue, 28 Aug 2018 13:08:05 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id 554F93E6078 for ; Tue, 28 Aug 2018 13:07:57 +0200 (CEST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 7DFC41401154 for ; Tue, 28 Aug 2018 13:07:57 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D85140241CB for ; Tue, 28 Aug 2018 11:07:56 +0000 (UTC) Received: from dustball.brq.redhat.com (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id F02B1112D19F; Tue, 28 Aug 2018 11:07:55 +0000 (UTC) From: Jan Stancek To: ltp@lists.linux.it, liwan@redhat.com Date: Tue, 28 Aug 2018 13:07:51 +0200 Message-Id: <58d20bf71d2f56126b7386b32d19a3a1382cc029.1535454204.git.jstancek@redhat.com> In-Reply-To: <6680bda80c85d424a5219d9f55dc9c5355dc0da1.1535454204.git.jstancek@redhat.com> References: <6680bda80c85d424a5219d9f55dc9c5355dc0da1.1535454204.git.jstancek@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 28 Aug 2018 11:07:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 28 Aug 2018 11:07:56 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jstancek@redhat.com' RCPT:'' X-Virus-Scanned: clamav-milter 0.99.2 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v2 2/2] move_pages12: end early if runtime gets close to test time X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Most systems can complete this reproducer in standard test time. Small groups of systems (e.g. aarch64 with 512M hugepages) can hit a timeout. Add a check for elapsed time and end test early if we are getting close (80%). Fixes: #387 Signed-off-by: Jan Stancek --- testcases/kernel/syscalls/move_pages/move_pages12.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c index 43acb42aabb1..284be957148f 100644 --- a/testcases/kernel/syscalls/move_pages/move_pages12.c +++ b/testcases/kernel/syscalls/move_pages/move_pages12.c @@ -40,6 +40,7 @@ #include #include "tst_test.h" +#include "tst_timer.h" #include "move_pages_support.h" #include "lapi/mmap.h" @@ -101,6 +102,9 @@ static void do_test(void) int i; pid_t cpid = -1; int status; + unsigned int test_time = (tst_get_timeout() / 5) * 4; + + tst_timer_start(CLOCK_MONOTONIC); addr = SAFE_MMAP(NULL, TEST_PAGES * hpsz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); @@ -123,14 +127,15 @@ static void do_test(void) memset(addr, 0, TEST_PAGES * hpsz); SAFE_MUNMAP(addr, TEST_PAGES * hpsz); - } - if (i == LOOPS) { - SAFE_KILL(cpid, SIGKILL); - SAFE_WAITPID(cpid, &status, 0); - if (!WIFEXITED(status)) - tst_res(TPASS, "Bug not reproduced"); + if (tst_timer_expired_ms(test_time)) + break; } + + SAFE_KILL(cpid, SIGKILL); + SAFE_WAITPID(cpid, &status, 0); + if (!WIFEXITED(status)) + tst_res(TPASS, "Bug not reproduced"); } static void alloc_free_huge_on_node(unsigned int node, size_t size) @@ -183,6 +188,8 @@ static void setup(void) int ret; long memfree; + tst_timer_check(CLOCK_MONOTONIC); + check_config(TEST_NODES); if (access(PATH_HUGEPAGES, F_OK))