From patchwork Tue Mar 19 09:38:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 1058317 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 ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Np0l1Wpwz9s6w for ; Tue, 19 Mar 2019 20:39:19 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A8E563EAEC6 for ; Tue, 19 Mar 2019 10:39:16 +0100 (CET) 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 [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id 79DD03EAE91 for ; Tue, 19 Mar 2019 10:39:10 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 E4A40600E39 for ; Tue, 19 Mar 2019 10:39:09 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A323CC13070B; Tue, 19 Mar 2019 09:39:05 +0000 (UTC) Received: from dhcp-12-157.nay.redhat.com (dhcp-12-157.nay.redhat.com [10.66.12.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACE7260CD3; Tue, 19 Mar 2019 09:39:02 +0000 (UTC) From: Li Wang To: ltp@lists.linux.it Date: Tue, 19 Mar 2019 17:38:56 +0800 Message-Id: <20190319093858.584-1-liwang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 19 Mar 2019 09:39:05 +0000 (UTC) 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 Cc: Vipin K Parashar Subject: [LTP] [PATCH RFC 1/3] min_free_kbytes: Fix child exit status check conditions 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Vipin K Parashar Fixes: #349 min_free_kbytes test has badly formed if conditions in mem_tune() for child exit status check. This is causing test to declare as FAILED despite that not being the case. Fix child exit status check conditions. ---ERROR LOG--- <..snip..> mem.c:839: INFO: set overcommit_memory to 1 mem.c:839: INFO: set min_free_kbytes to 11580 memfree is 6974720 kB before eatup mem memfree is 15488 kB after eatup mem min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0 mem.c:839: INFO: set min_free_kbytes to 23160 memfree is 7104128 kB before eatup mem memfree is 26560 kB after eatup mem min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0 mem.c:839: INFO: set min_free_kbytes to 145812 memfree is 7101504 kB before eatup mem memfree is 215872 kB after eatup mem min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0 min_free_kbytes.c:81: PASS: min_free_kbytes test pass mem.c:839: INFO: set min_free_kbytes to 11580 --------------- Signed-off-by: Vipin K Parashar Signed-off-by: Li Wang Cc: Jan Stancek --- .../kernel/mem/tunable/min_free_kbytes.c | 40 +++++-------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/testcases/kernel/mem/tunable/min_free_kbytes.c b/testcases/kernel/mem/tunable/min_free_kbytes.c index f114dc493..d2378a700 100644 --- a/testcases/kernel/mem/tunable/min_free_kbytes.c +++ b/testcases/kernel/mem/tunable/min_free_kbytes.c @@ -119,39 +119,21 @@ static void test_tune(unsigned long overcommit_policy) SAFE_WAITPID(pid[i], &status, WUNTRACED | WCONTINUED); - if (overcommit_policy == 2) { - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) - tst_res(TFAIL, - "child unexpectedly failed: %d", - status); - } else if (overcommit_policy == 1) { - if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGKILL) + if (WIFEXITED(status) && WEXITSTATUS(status) != 0) { + tst_res(TFAIL, + "child unexpectedly failed: %d", status); + } else if (WIFSIGNALED(status) && WTERMSIG(status) != SIGKILL) { #if __WORDSIZE == 32 - { - if (total_mem < 3145728UL) + if (total_mem < 3145728UL) #endif - tst_res(TFAIL, - "child unexpectedly failed: %d", - status); + tst_res(TFAIL, + "child unexpectedly failed: %d", status); #if __WORDSIZE == 32 - /* in 32-bit system, a process allocate about 3Gb memory at most */ - else - tst_res(TINFO, "Child can't allocate " - ">3Gb memory in 32bit system"); - } + /* in 32-bit system, a process allocate about 3Gb memory at most */ + else + tst_res(TINFO, "Child can't allocate " + ">3Gb memory in 32bit system"); #endif - } else { - if (WIFEXITED(status)) { - if (WEXITSTATUS(status) != 0) { - tst_res(TFAIL, "child unexpectedly " - "failed: %d", status); - } - } else if (!WIFSIGNALED(status) || - WTERMSIG(status) != SIGKILL) { - tst_res(TFAIL, - "child unexpectedly failed: %d", - status); - } } } }