From patchwork Mon Dec 5 23:08:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13065167 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D93B1C63704 for ; Mon, 5 Dec 2022 23:08:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B26A88E000B; Mon, 5 Dec 2022 18:08:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A62228E0009; Mon, 5 Dec 2022 18:08:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 818978E000B; Mon, 5 Dec 2022 18:08:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6AC768E0009 for ; Mon, 5 Dec 2022 18:08:43 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3A762AB205 for ; Mon, 5 Dec 2022 23:08:43 +0000 (UTC) X-FDA: 80209794126.14.D59AF4C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id E07201A000D for ; Mon, 5 Dec 2022 23:08:42 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=k78k7YEx; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670281722; a=rsa-sha256; cv=none; b=l+GMmyUETJIYuLO2nmeeGNMOgURuIf/ItdlBxLMB/XEMK2VdP3XPmYpN8+XXsKLZMQBwX/ psLIJz3Y3ULRZcTlcKVceNlyY3rxrZfPJ6z21qQyndQtyqX8NRaWp8vNHBUWr8Y4dk1+PO qrsa5bOkZSxSCOF8/CHqB4pQxwhArhQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=k78k7YEx; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670281722; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+OTj21n3Wg9gwrrIBxAx4NidZtXBp6SPjJpmtwVGK9A=; b=xgnWRUpWCrHEU+7N13DbaeF3BXgnrKDnUJl/D+W8zoSNdZQMl45dvOecWci7NvPYRbB8x4 R1Qs6cukuTc5khm1r4f0yrP00+KFvShlFkIwmuEm28JWRvfQeAGfs5nMuJo1LK8nVV7oVa qkmYoSJd2iTtjERoyahrkCXu64a7vt0= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3DB57614C1; Mon, 5 Dec 2022 23:08:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28A3AC433D6; Mon, 5 Dec 2022 23:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670281721; bh=qgpIYxCoLxiSbmookPCEJSX95mijzZoDksXEWue5IhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k78k7YExuF6/YEEvcLQCrdPFVM8+qZ66Sw1wGSQt1vOP6nrkfOevcW9LvmA+peVW5 aDGsFBfIOyR+pD6XRfeyIyNJq6d6quIA1qUV451ks6L5wwqGhGcaPKXvj6Pg0kIFn8 BATF7tCEg6mGkduLufzPqMOvR3R8PoZDrrnIHcIW9nNoWcaXgzH/V7/0z03ujbr1AS Azx5pHsw1fGteX+pc6NdS8LbE1lyO4RXhdINeyGAhRwyiQMBg+5EleKrTIgEnfU5Nk zfHofzo5dszklOcY3XDH/svZ9cz0X2+TqTsRq03hk8zd9m38KcvvTi3p0Bke4T1KDM bGdKopAY9JjLQ== From: SeongJae Park To: Andrew Morton Cc: Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 09/11] selftests/damon/sysfs: test filters directory Date: Mon, 5 Dec 2022 23:08:28 +0000 Message-Id: <20221205230830.144349-10-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221205230830.144349-1-sj@kernel.org> References: <20221205230830.144349-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Spamd-Result: default: False [-0.09 / 9.00]; BAYES_HAM(-5.69)[99.33%]; R_MISSING_CHARSET(2.50)[]; IRL_BL_25(2.00)[52.25.139.140:received]; MID_CONTAINS_FROM(1.00)[]; RCVD_NO_TLS_LAST(0.10)[]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_ALLOW(0.00)[kernel.org,none]; RCPT_COUNT_SEVEN(0.00)[7]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[kernel.org:+]; RCVD_COUNT_THREE(0.00)[3]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; R_DKIM_ALLOW(0.00)[kernel.org:s=k20201202]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(0.00)[+a:dfw.source.kernel.org:c]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: E07201A000D X-Rspamd-Server: rspam01 X-Stat-Signature: 6d6aybeh9ssnxdz5nqe6856yfy7s4f9n X-HE-Tag: 1670281722-708946 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: Add simple test cases for scheme filters of DAMON sysfs interface. The test cases check if the files are populated as expected, receives some valid inputs, and refuses some invalid inputs. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.sh | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh index db4942383a50..a00336ffdcad 100644 --- a/tools/testing/selftests/damon/sysfs.sh +++ b/tools/testing/selftests/damon/sysfs.sh @@ -96,6 +96,34 @@ test_stats() done } +test_filter() +{ + filter_dir=$1 + ensure_file "$filter_dir/type" "exist" "600" + ensure_write_succ "$filter_dir/type" "anon" "valid input" + ensure_write_succ "$filter_dir/type" "memcg" "valid input" + ensure_write_fail "$filter_dir/type" "foo" "invalid input" + ensure_file "$filter_dir/matching" "exist" "600" + ensure_file "$filter_dir/memcg_path" "exist" "600" +} + +test_filters() +{ + filters_dir=$1 + ensure_dir "$filters_dir" "exist" + ensure_file "$filters_dir/nr_filters" "exist" "600" + ensure_write_succ "$filters_dir/nr_filters" "1" "valid input" + test_filter "$filters_dir/0" + + ensure_write_succ "$filters_dir/nr_filters" "2" "valid input" + test_filter "$filters_dir/0" + test_filter "$filters_dir/1" + + ensure_write_succ "$filters_dir/nr_filters" "0" "valid input" + ensure_dir "$filters_dir/0" "not_exist" + ensure_dir "$filters_dir/1" "not_exist" +} + test_watermarks() { watermarks_dir=$1 @@ -143,6 +171,7 @@ test_scheme() test_access_pattern "$scheme_dir/access_pattern" test_quotas "$scheme_dir/quotas" test_watermarks "$scheme_dir/watermarks" + test_filters "$scheme_dir/filters" test_stats "$scheme_dir/stats" test_tried_regions "$scheme_dir/tried_regions" }