From patchwork Mon Aug 27 14:06:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 962522 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 41zYbm376Xz9s4V for ; Tue, 28 Aug 2018 00:07:00 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DDE723E72BA for ; Mon, 27 Aug 2018 16:06:55 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 57EBE3E7256 for ; Mon, 27 Aug 2018 16:06:53 +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-4.smtp.seeweb.it (Postfix) with ESMTPS id C48111000C1A for ; Mon, 27 Aug 2018 16:06:50 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 710714023461 for ; Mon, 27 Aug 2018 14:06:49 +0000 (UTC) Received: from dustball.brq.redhat.com (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90B752166B41 for ; Mon, 27 Aug 2018 14:06:48 +0000 (UTC) From: Jan Stancek To: ltp@lists.linux.it Date: Mon, 27 Aug 2018 16:06:44 +0200 Message-Id: <5b181737029c9687f7cc7c49a9d15b415e62a1bc.1535378672.git.jstancek@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 27 Aug 2018 14:06:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 27 Aug 2018 14:06:49 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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-4.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-4.smtp.seeweb.it Subject: [LTP] [PATCH] 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 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c index c0ff27114110..2813097871e4 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" @@ -51,6 +52,7 @@ #define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/" #define TEST_PAGES 2 #define TEST_NODES 2 +#define TEST_TIMEOUT 300 static int pgsz, hpsz; static long orig_hugepages = -1; @@ -102,6 +104,8 @@ static void do_test(void) pid_t cpid = -1; int status; + 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_TIMEOUT)) + 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)) @@ -265,6 +272,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .test_all = do_test, + .timeout = (TEST_TIMEOUT / 5) * 6, }; #else