From patchwork Thu Feb 18 02:56:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1441509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dgzqm27l0z9sCD for ; Thu, 18 Feb 2021 13:56:20 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BFC75385041A; Thu, 18 Feb 2021 02:56:16 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by sourceware.org (Postfix) with ESMTP id 17F6C3858031 for ; Thu, 18 Feb 2021 02:56:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 17F6C3858031 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=xuyang2018.jy@cn.fujitsu.com X-IronPort-AV: E=Sophos;i="5.81,185,1610380800"; d="scan'208";a="104591257" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 Feb 2021 10:56:11 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id BF7574CE6F85 for ; Thu, 18 Feb 2021 10:56:09 +0800 (CST) Received: from localhost.localdomain (10.167.220.84) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 18 Feb 2021 10:56:09 +0800 From: Yang Xu To: Subject: [PATCH v2] tst-mallinfo2.c: Use correct multiple for total variable Date: Thu, 18 Feb 2021 10:56:33 +0800 Message-ID: <1613616993-2623-1-git-send-email-xuyang2018.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD06.g08.fujitsu.local (10.167.33.205) To G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) X-yoursite-MailScanner-ID: BF7574CE6F85.A0F66 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: xuyang2018.jy@cn.fujitsu.com X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Xu Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Since test uses 160 multiple for malloc size, we should also use 160 multiple for total variable instead of 16, then comparison is meaningful. So fix it. Also change the ">" to ">=" so that the test is technically valid. --- malloc/tst-mallinfo2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/malloc/tst-mallinfo2.c b/malloc/tst-mallinfo2.c index 59a15cf7a8..7d00b65f6e 100644 --- a/malloc/tst-mallinfo2.c +++ b/malloc/tst-mallinfo2.c @@ -68,14 +68,14 @@ do_test (void) for (i = 1; i < 20; ++i) { ptr = malloc (160 * i); - total += 16 * i; + total += 160 * i; } mi2 = mallinfo2 (); print_mi ("after", &mi2); /* Check at least something changed. */ - TEST_VERIFY (mi2.uordblks > mi1.uordblks + total); + TEST_VERIFY (mi2.uordblks >= mi1.uordblks + total); return 0; }