From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Shuah Khan <shuah@kernel.org>,
damon@lists.linux.dev, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
SeongJae Park <sj@kernel.org>
Subject: [PATCH 09/11] selftests/damon/sysfs: test filters directory
Date: Mon, 5 Dec 2022 23:08:28 +0000 [thread overview]
Message-ID: <20221205230830.144349-10-sj@kernel.org> (raw)
In-Reply-To: <20221205230830.144349-1-sj@kernel.org>
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 <sj@kernel.org>
---
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"
}
--
2.25.1
next prev parent reply other threads:[~2022-12-05 23:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 23:08 [PATCH 00/11] implement DAMOS filtering for anon pages and SeongJae Park
2022-12-05 23:08 ` [PATCH 01/11] mm/damon/core: implement damos filter SeongJae Park
2022-12-05 23:08 ` [PATCH 02/11] mm/damon/paddr: support DAMOS filters SeongJae Park
2022-12-05 23:08 ` [PATCH 03/11] mm/damon/reclaim: add a parameter called skip_anon for avoiding anonymous pages reclamation SeongJae Park
2022-12-05 23:08 ` [PATCH 04/11] Docs/admin-guide/damon/reclaim: document 'skip_anon' parameter SeongJae Park
2022-12-05 23:08 ` [PATCH 05/11] mm/damon/sysfs-schemes: implement filters directory SeongJae Park
2022-12-05 23:08 ` [PATCH 06/11] mm/damon/sysfs-schemes: implement filter directory SeongJae Park
2022-12-05 23:08 ` [PATCH 07/11] mm/damon/sysfs-schemes: connect filter directory and filters directory SeongJae Park
2022-12-05 23:08 ` [PATCH 08/11] mm/damon/sysfs-schemes: implement scheme filters SeongJae Park
2022-12-05 23:08 ` SeongJae Park [this message]
2022-12-05 23:08 ` [PATCH 10/11] Docs/admin-guide/mm/damon/usage: document DAMOS filters of sysfs SeongJae Park
2022-12-05 23:08 ` [PATCH 11/11] Docs/ABI/damon: document scheme filters files SeongJae Park
2022-12-16 23:59 ` [PATCH 00/11] implement DAMOS filtering for anon pages and Andrew Morton
2022-12-17 0:02 ` SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221205230830.144349-10-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.