From patchwork Thu Oct 28 09:06:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12589595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3013DC433EF for ; Thu, 28 Oct 2021 09:06:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D82A261056 for ; Thu, 28 Oct 2021 09:06:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D82A261056 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 71843940007; Thu, 28 Oct 2021 05:06:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C68A6B0072; Thu, 28 Oct 2021 05:06:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58F53940007; Thu, 28 Oct 2021 05:06:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id 2EDCD6B0071 for ; Thu, 28 Oct 2021 05:06:40 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8F9CD2BC30 for ; Thu, 28 Oct 2021 09:06:39 +0000 (UTC) X-FDA: 78745265718.21.A6F9CB9 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf12.hostedemail.com (Postfix) with ESMTP id 4163210003E7 for ; Thu, 28 Oct 2021 09:06:39 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 95DD460232; Thu, 28 Oct 2021 09:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635411998; bh=8sAgKTwdQzQ8h0WZL0biBhP95bRt2tmfL7nHB6meuR0=; h=From:To:Cc:Subject:Date:From; b=rfIMSVP8xEIqSvEz+AR5/ZsPBEVBvzLxn5NIlSxmCWz4ErvVEoLeNHAjKGHydq1Vz SyteG3ixsKXjr2S6Yh94XROyAVaUwTRNu+I6Waai0pVmRpCgRm7lN8PYxaqkdmJonh OrS4gphOu3cvxE2ZsTpaWSQKoOvXe02cVE2fRCAgyMmtynL70npyWbG+z+jeFtJcSw B7bPufwyGA5tzr7BgvNXe3xPXzekc2E3NLWC4jCo4KGUS3vzOcwt5OYDU7YVowQqlF NJxobGMlDisplb8s7fOHrLn5e8kDTPp4sOruY4FwbyGDrqfVBluQMeV4SNHTKw3I/+ nEW/dUsWfXn3g== From: SeongJae Park To: akpm@linux-foundation.org Cc: brendanhiggins@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH] mm/damon/core-test: Fix wrong expectations for 'damon_split_regions_of()' Date: Thu, 28 Oct 2021 09:06:28 +0000 Message-Id: <20211028090628.14948-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4163210003E7 X-Stat-Signature: 5r7sftmg18yybypos9xxdh7617e4t5pk Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rfIMSVP8; spf=pass (imf12.hostedemail.com: domain of sj@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1635411999-991672 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Kunit test cases for 'damon_split_regions_of()' expects the number of regions after calling the function will be same to their request ('nr_sub'). However, the requested number is just an upper-limit, because the function randomly decides the size of each sub-region. This commit fixes the wrong expectation. Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") Signed-off-by: SeongJae Park --- mm/damon/core-test.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/damon/core-test.h b/mm/damon/core-test.h index c938a9c34e6c..7008c3735e99 100644 --- a/mm/damon/core-test.h +++ b/mm/damon/core-test.h @@ -219,14 +219,14 @@ static void damon_test_split_regions_of(struct kunit *test) r = damon_new_region(0, 22); damon_add_region(r, t); damon_split_regions_of(c, t, 2); - KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 2u); + KUNIT_EXPECT_LE(test, damon_nr_regions(t), 2u); damon_free_target(t); t = damon_new_target(42); r = damon_new_region(0, 220); damon_add_region(r, t); damon_split_regions_of(c, t, 4); - KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 4u); + KUNIT_EXPECT_LE(test, damon_nr_regions(t), 4u); damon_free_target(t); damon_destroy_ctx(c); }