From patchwork Thu Oct 28 21:36:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12591239 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 CA86CC433FE for ; Thu, 28 Oct 2021 21:36:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8D2F7610CA for ; Thu, 28 Oct 2021 21:36:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8D2F7610CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 28F8A6B0083; Thu, 28 Oct 2021 17:36:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 23E2C6B0085; Thu, 28 Oct 2021 17:36:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 106986B0087; Thu, 28 Oct 2021 17:36:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id DA9136B0083 for ; Thu, 28 Oct 2021 17:36:35 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7A2ED8249980 for ; Thu, 28 Oct 2021 21:36:35 +0000 (UTC) X-FDA: 78747155592.01.4B3CA69 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf24.hostedemail.com (Postfix) with ESMTP id 22AF2B00081F for ; Thu, 28 Oct 2021 21:36:35 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 270DB610D2; Thu, 28 Oct 2021 21:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1635456994; bh=X6fs3f2fSOBDq+IJaZt2fhaL5UXblQ955KaLJm/Tiuc=; h=Date:From:To:Subject:In-Reply-To:From; b=Ofseem+jB3XecyPHSmkd5sZ3dV1NoNSEGSb6Rf70npQDCpugki2qgB31JizKr8doJ QQRd1mCdejtCE1N8N3bbzJZsl8cPahQXs+bECNX8jxnWuzHgvD+ubqnZvcp/ddA/hP GKLLJ7k7Foda+pEHcXeFhES1ADGRm7Q6D31VGq9U= Date: Thu, 28 Oct 2021 14:36:33 -0700 From: Andrew Morton To: akpm@linux-foundation.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, sj@kernel.org, torvalds@linux-foundation.org Subject: [patch 10/11] mm/damon/core-test: fix wrong expectations for 'damon_split_regions_of()' Message-ID: <20211028213633.VtZv_vHJo%akpm@linux-foundation.org> In-Reply-To: <20211028143506.5f5d5e2cd1f768a1da864844@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 22AF2B00081F X-Stat-Signature: 34jaut4seoow634afd79ykobbcx9sup9 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Ofseem+j; dmarc=none; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1635456995-995310 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: From: SeongJae Park Subject: mm/damon/core-test: fix wrong expectations for 'damon_split_regions_of()' 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. Link: https://lkml.kernel.org/r/20211028090628.14948-1-sj@kernel.org Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") Signed-off-by: SeongJae Park Signed-off-by: Andrew Morton --- mm/damon/core-test.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/damon/core-test.h~mm-damon-core-test-fix-wrong-expectations-for-damon_split_regions_of +++ a/mm/damon/core-test.h @@ -219,14 +219,14 @@ static void damon_test_split_regions_of( 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); }