]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/mm: deduplicate test names in madv_populate
authorMark Brown <broonie@kernel.org>
Thu, 22 May 2025 16:29:00 +0000 (17:29 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 1 Jun 2025 05:46:13 +0000 (22:46 -0700)
The madv_populate selftest has some repetitive code for several different
cases that it covers, included repeated test names used in
ksft_test_result() reports.  This causes problems for automation, the test
name is used to both track the test between runs and distinguish between
multiple tests within the same run.  Fix this by tweaking the messages
with duplication to be more specific about the contexts they're in.

Link: https://lkml.kernel.org/r/20250522-selftests-mm-madv-populate-dedupe-v1-1-fd1dedd79b4b@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/madv_populate.c

index ef7d911da13e01bd6096272787c4bfd0c2bed383..b6fabd5c27ed6149630dd994450811b886779445 100644 (file)
@@ -172,12 +172,12 @@ static void test_populate_read(void)
        if (addr == MAP_FAILED)
                ksft_exit_fail_msg("mmap failed\n");
        ksft_test_result(range_is_not_populated(addr, SIZE),
-                        "range initially not populated\n");
+                        "read range initially not populated\n");
 
        ret = madvise(addr, SIZE, MADV_POPULATE_READ);
        ksft_test_result(!ret, "MADV_POPULATE_READ\n");
        ksft_test_result(range_is_populated(addr, SIZE),
-                        "range is populated\n");
+                        "read range is populated\n");
 
        munmap(addr, SIZE);
 }
@@ -194,12 +194,12 @@ static void test_populate_write(void)
        if (addr == MAP_FAILED)
                ksft_exit_fail_msg("mmap failed\n");
        ksft_test_result(range_is_not_populated(addr, SIZE),
-                        "range initially not populated\n");
+                        "write range initially not populated\n");
 
        ret = madvise(addr, SIZE, MADV_POPULATE_WRITE);
        ksft_test_result(!ret, "MADV_POPULATE_WRITE\n");
        ksft_test_result(range_is_populated(addr, SIZE),
-                        "range is populated\n");
+                        "write range is populated\n");
 
        munmap(addr, SIZE);
 }
@@ -247,19 +247,19 @@ static void test_softdirty(void)
        /* Clear any softdirty bits. */
        clear_softdirty();
        ksft_test_result(range_is_not_softdirty(addr, SIZE),
-                        "range is not softdirty\n");
+                        "cleared range is not softdirty\n");
 
        /* Populating READ should set softdirty. */
        ret = madvise(addr, SIZE, MADV_POPULATE_READ);
-       ksft_test_result(!ret, "MADV_POPULATE_READ\n");
+       ksft_test_result(!ret, "softdirty MADV_POPULATE_READ\n");
        ksft_test_result(range_is_not_softdirty(addr, SIZE),
-                        "range is not softdirty\n");
+                        "range is not softdirty after MADV_POPULATE_READ\n");
 
        /* Populating WRITE should set softdirty. */
        ret = madvise(addr, SIZE, MADV_POPULATE_WRITE);
-       ksft_test_result(!ret, "MADV_POPULATE_WRITE\n");
+       ksft_test_result(!ret, "softdirty MADV_POPULATE_WRITE\n");
        ksft_test_result(range_is_softdirty(addr, SIZE),
-                        "range is softdirty\n");
+                        "range is softdirty after MADV_POPULATE_WRITE \n");
 
        munmap(addr, SIZE);
 }