diff mbox series

[v14,13/15] mm/damon-test: Add a kunit test for recording setup

Message ID 20200602131549.23617-1-sjpark@amazon.com (mailing list archive)
State New, archived
Headers show
Series Introduce Data Access MONitor (DAMON) | expand

Commit Message

SeongJae Park June 2, 2020, 1:15 p.m. UTC
From: SeongJae Park <sjpark@amazon.de>

This commit adds another unit test case for the recording setup.

Signed-off-by: SeongJae Park <sjpark@amazon.de>
---
 mm/damon-test.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Brendan Higgins June 2, 2020, 8:28 p.m. UTC | #1
On Tue, Jun 2, 2020 at 6:16 AM SeongJae Park <sjpark@amazon.com> wrote:
>
> From: SeongJae Park <sjpark@amazon.de>
>
> This commit adds another unit test case for the recording setup.
>
> Signed-off-by: SeongJae Park <sjpark@amazon.de>

Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Brendan Higgins June 3, 2020, 9:07 p.m. UTC | #2
On Wed, Jun 3, 2020 at 5:42 AM SeongJae Park <sjpark@amazon.com> wrote:
>
> On Tue, 2 Jun 2020 13:28:03 -0700 Brendan Higgins <brendanhiggins@google.com> wrote:
>
> > On Tue, Jun 2, 2020 at 6:16 AM SeongJae Park <sjpark@amazon.com> wrote:
> > >
> > > From: SeongJae Park <sjpark@amazon.de>
> > >
> > > This commit adds another unit test case for the recording setup.
> > >
> > > Signed-off-by: SeongJae Park <sjpark@amazon.de>
> >
> > Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
>
> Thanks for the review!  As the previous patch is also for the kunit test and it
> already received your 'Reviewed-by', I would like to merge this patch into the
> previous one in the next spin.  If there is any problem, please let me know.

No problem. Feel free to do so.
diff mbox series

Patch

diff --git a/mm/damon-test.h b/mm/damon-test.h
index cf715529ff64..5b18619efe72 100644
--- a/mm/damon-test.h
+++ b/mm/damon-test.h
@@ -137,6 +137,18 @@  static void damon_test_set_pids(struct kunit *test)
 	KUNIT_EXPECT_STREQ(test, (char *)buf, "\n");
 }
 
+static void damon_test_set_recording(struct kunit *test)
+{
+	struct damon_ctx *ctx = &damon_user_ctx;
+
+	damon_set_recording(ctx, 4242, "foo.bar");
+	KUNIT_EXPECT_EQ(test, ctx->rbuf_len, 4242u);
+	KUNIT_EXPECT_STREQ(test, ctx->rfile_path, "foo.bar");
+	damon_set_recording(ctx, 42, "foo");
+	KUNIT_EXPECT_EQ(test, ctx->rbuf_len, 42u);
+	KUNIT_EXPECT_STREQ(test, ctx->rfile_path, "foo");
+}
+
 /*
  * Test damon_three_regions_in_vmas() function
  *
@@ -596,6 +608,7 @@  static struct kunit_case damon_test_cases[] = {
 	KUNIT_CASE(damon_test_tasks),
 	KUNIT_CASE(damon_test_regions),
 	KUNIT_CASE(damon_test_set_pids),
+	KUNIT_CASE(damon_test_set_recording),
 	KUNIT_CASE(damon_test_three_regions_in_vmas),
 	KUNIT_CASE(damon_test_aggregate),
 	KUNIT_CASE(damon_test_write_rbuf),