From patchwork Thu Nov 24 21:21:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13055370 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 4CC8DC4321E for ; Thu, 24 Nov 2022 21:21:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C5378E0008; Thu, 24 Nov 2022 16:21:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FD5D8E0007; Thu, 24 Nov 2022 16:21:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 121648E0002; Thu, 24 Nov 2022 16:21:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DB2CA8E0006 for ; Thu, 24 Nov 2022 16:21:26 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A0BBF140512 for ; Thu, 24 Nov 2022 21:21:26 +0000 (UTC) X-FDA: 80169606972.20.1868B1B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id 558631C000E for ; Thu, 24 Nov 2022 21:21:26 +0000 (UTC) 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 A51FD6224C; Thu, 24 Nov 2022 21:21:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83EE2C4314E; Thu, 24 Nov 2022 21:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669324885; bh=qgpIYxCoLxiSbmookPCEJSX95mijzZoDksXEWue5IhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bg/AaYGuCYp4M6g57krHOS5GWS+hMi8p5mp+UkjqKaATqZdbygBxDo8pgT5J/V8X5 SeOHpO64VwGb7y2NaTnqWlKcalc/qi6/1yqlseWD2aN0cLZ/0YkzPD+ojVlCjvRKEV tSYo5MiT45nugk3U6ZhWpSImAmvbsV4ikvCk3UFc4RYwy3Ha4KpsJGmK3YSgVoFkQK x8D4bqBobH8wUsPcV4hGQ3erCz7bbPrQmYK9GHlUPwBQrZ6x6vEN9uq+K11ExWHJHy 2xNyShxK/2Ww69uIIYUGBPs7HvreQTYXdhvw2zuS7KG/0AVZPTh2PUzt8JDtgk8pt8 Y2I5aPTMH5/IA== 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: [RFC PATCH 09/11] selftests/damon/sysfs: test filters directory Date: Thu, 24 Nov 2022 21:21:12 +0000 Message-Id: <20221124212114.136863-10-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221124212114.136863-1-sj@kernel.org> References: <20221124212114.136863-1-sj@kernel.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669324886; a=rsa-sha256; cv=none; b=3U4tZ8e5QjfQIncqqbkBd6m4Phh6sjIRQXGPE81+pDT7KZURS+YkhQKTGd7FQsSIgIMtC8 PeFsbLjCod78rz5zm4BTXP6Jtr/OhUhB8d7or2gGzqHJJzHmJae9eOrR+DQNXH5XZv0Pmd wVr3wtKOaaSccFglTCoqieDweIfuiCs= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="bg/AaYGu"; spf=pass (imf21.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=1669324886; 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=Ge5/mqKzQkwZnHqwr67vJ8ieZRH4vWNFLaxgI9JSo62hL8elJBmh30SrFaVV7PgVyFnf0U IlOTIZ9OkRuVz1JzRStOAHaayV0vvaj0LR+JiBwho+GwebyfhijRQUtu7nxjYhwi1ZvD5q YlZ3IxPM6txjL+gMgOAPaeyGNv44YD0= X-Rspam-User: Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="bg/AaYGu"; spf=pass (imf21.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 X-Stat-Signature: hnbj4wurpx35mzxw7gepup8naeu81cb7 X-Rspamd-Queue-Id: 558631C000E X-Rspamd-Server: rspam12 X-HE-Tag: 1669324886-357521 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" }