From: SeongJae Park <[email protected]>

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

Signed-off-by: SeongJae Park <[email protected]>
---
 mm/damon-test.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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),
-- 
2.17.1

Reply via email to