selftests/mm: mseal, self_elf: rename TEST_END_CHECK to REPORT_TEST_PASS
authorJohn Hubbard <jhubbard@nvidia.com>
Tue, 18 Jun 2024 02:24:19 +0000 (19:24 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:07 +0000 (19:30 -0700)
Now that the test macros are factored out into their final location, and
simplified, it's time to rename TEST_END_CHECK to something that
represents its new functionality: REPORT_TEST_PASS.

Link: https://lkml.kernel.org/r/20240618022422.804305-4-jhubbard@nvidia.com
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Jeff Xu <jeffxu@chromium.org>
Tested-by: Jeff Xu <jeffxu@chromium.org>
Cc: Andrei Vagin <avagin@google.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Rich Felker <dalias@libc.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/mseal_helpers.h
tools/testing/selftests/mm/mseal_test.c
tools/testing/selftests/mm/seal_elf.c

index 108d3fd0becb729047c0c308c8d08564f810af6e..0cfce31c76d2454c7cb111c4bcb9746af6a169fb 100644 (file)
@@ -18,7 +18,7 @@
                }                                                       \
        } while (0)
 
-#define TEST_END_CHECK() ksft_test_result_pass("%s\n", __func__)
+#define REPORT_TEST_PASS() ksft_test_result_pass("%s\n", __func__)
 
 #ifndef PKEY_DISABLE_ACCESS
 #define PKEY_DISABLE_ACCESS    0x1
index d4d6ae42f5027e36356b62c816e05ec0dd391d6d..a818f010de479a942b7eaa22277f79ed5f510374 100644 (file)
@@ -240,7 +240,7 @@ static void test_seal_addseal(void)
        ret = sys_mseal(ptr, size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_unmapped_start(void)
@@ -268,7 +268,7 @@ static void test_seal_unmapped_start(void)
        ret = sys_mseal(ptr + 2 * page_size, 2 * page_size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_unmapped_middle(void)
@@ -300,7 +300,7 @@ static void test_seal_unmapped_middle(void)
        ret = sys_mseal(ptr + 3 * page_size, page_size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_unmapped_end(void)
@@ -329,7 +329,7 @@ static void test_seal_unmapped_end(void)
        ret = sys_mseal(ptr, 2 * page_size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_multiple_vmas(void)
@@ -360,7 +360,7 @@ static void test_seal_multiple_vmas(void)
        ret = sys_mseal(ptr, size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_split_start(void)
@@ -385,7 +385,7 @@ static void test_seal_split_start(void)
        ret = sys_mseal(ptr + page_size, 3 * page_size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_split_end(void)
@@ -410,7 +410,7 @@ static void test_seal_split_end(void)
        ret = sys_mseal(ptr, 3 * page_size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_invalid_input(void)
@@ -445,7 +445,7 @@ static void test_seal_invalid_input(void)
        ret = sys_mseal(ptr - page_size, 5 * page_size);
        FAIL_TEST_IF_FALSE(ret < 0);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_zero_length(void)
@@ -469,7 +469,7 @@ static void test_seal_zero_length(void)
        ret = sys_mprotect(ptr, size, PROT_READ | PROT_WRITE);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_zero_address(void)
@@ -495,7 +495,7 @@ static void test_seal_zero_address(void)
        ret = sys_mprotect(ptr, size, PROT_READ | PROT_WRITE);
        FAIL_TEST_IF_FALSE(ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_twice(void)
@@ -515,7 +515,7 @@ static void test_seal_twice(void)
        ret = sys_mseal(ptr, size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect(bool seal)
@@ -539,7 +539,7 @@ static void test_seal_mprotect(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_start_mprotect(bool seal)
@@ -569,7 +569,7 @@ static void test_seal_start_mprotect(bool seal)
                        PROT_READ | PROT_WRITE);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_end_mprotect(bool seal)
@@ -599,7 +599,7 @@ static void test_seal_end_mprotect(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect_unalign_len(bool seal)
@@ -628,7 +628,7 @@ static void test_seal_mprotect_unalign_len(bool seal)
                        PROT_READ | PROT_WRITE);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect_unalign_len_variant_2(bool seal)
@@ -656,7 +656,7 @@ static void test_seal_mprotect_unalign_len_variant_2(bool seal)
                        PROT_READ | PROT_WRITE);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect_two_vma(bool seal)
@@ -691,7 +691,7 @@ static void test_seal_mprotect_two_vma(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect_two_vma_with_split(bool seal)
@@ -738,7 +738,7 @@ static void test_seal_mprotect_two_vma_with_split(bool seal)
                        PROT_READ | PROT_WRITE);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect_partial_mprotect(bool seal)
@@ -764,7 +764,7 @@ static void test_seal_mprotect_partial_mprotect(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect_two_vma_with_gap(bool seal)
@@ -807,7 +807,7 @@ static void test_seal_mprotect_two_vma_with_gap(bool seal)
        ret = sys_mprotect(ptr + 3 * page_size, page_size, PROT_READ);
        FAIL_TEST_IF_FALSE(ret == 0);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect_split(bool seal)
@@ -844,7 +844,7 @@ static void test_seal_mprotect_split(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mprotect_merge(bool seal)
@@ -878,7 +878,7 @@ static void test_seal_mprotect_merge(bool seal)
        ret = sys_mprotect(ptr + 2 * page_size, 2 * page_size, PROT_READ);
        FAIL_TEST_IF_FALSE(ret == 0);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_munmap(bool seal)
@@ -903,7 +903,7 @@ static void test_seal_munmap(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 /*
@@ -943,7 +943,7 @@ static void test_seal_munmap_two_vma(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 /*
@@ -981,7 +981,7 @@ static void test_seal_munmap_vma_with_gap(bool seal)
        ret = sys_munmap(ptr, size);
        FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_munmap_start_freed(bool seal)
@@ -1021,7 +1021,7 @@ static void test_munmap_start_freed(bool seal)
                FAIL_TEST_IF_FALSE(size == 0);
        }
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_munmap_end_freed(bool seal)
@@ -1051,7 +1051,7 @@ static void test_munmap_end_freed(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_munmap_middle_freed(bool seal)
@@ -1095,7 +1095,7 @@ static void test_munmap_middle_freed(bool seal)
                FAIL_TEST_IF_FALSE(size == 0);
        }
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_shrink(bool seal)
@@ -1124,7 +1124,7 @@ static void test_seal_mremap_shrink(bool seal)
 
        }
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_expand(bool seal)
@@ -1156,7 +1156,7 @@ static void test_seal_mremap_expand(bool seal)
 
        }
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_move(bool seal)
@@ -1189,7 +1189,7 @@ static void test_seal_mremap_move(bool seal)
 
        }
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mmap_overwrite_prot(bool seal)
@@ -1217,7 +1217,7 @@ static void test_seal_mmap_overwrite_prot(bool seal)
        } else
                FAIL_TEST_IF_FALSE(ret2 == ptr);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mmap_expand(bool seal)
@@ -1248,7 +1248,7 @@ static void test_seal_mmap_expand(bool seal)
        } else
                FAIL_TEST_IF_FALSE(ret2 == ptr);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mmap_shrink(bool seal)
@@ -1276,7 +1276,7 @@ static void test_seal_mmap_shrink(bool seal)
        } else
                FAIL_TEST_IF_FALSE(ret2 == ptr);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_shrink_fixed(bool seal)
@@ -1307,7 +1307,7 @@ static void test_seal_mremap_shrink_fixed(bool seal)
        } else
                FAIL_TEST_IF_FALSE(ret2 == newAddr);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_expand_fixed(bool seal)
@@ -1338,7 +1338,7 @@ static void test_seal_mremap_expand_fixed(bool seal)
        } else
                FAIL_TEST_IF_FALSE(ret2 == newAddr);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_move_fixed(bool seal)
@@ -1368,7 +1368,7 @@ static void test_seal_mremap_move_fixed(bool seal)
        } else
                FAIL_TEST_IF_FALSE(ret2 == newAddr);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_move_fixed_zero(bool seal)
@@ -1400,7 +1400,7 @@ static void test_seal_mremap_move_fixed_zero(bool seal)
 
        }
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_move_dontunmap(bool seal)
@@ -1429,7 +1429,7 @@ static void test_seal_mremap_move_dontunmap(bool seal)
 
        }
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_mremap_move_dontunmap_anyaddr(bool seal)
@@ -1463,7 +1463,7 @@ static void test_seal_mremap_move_dontunmap_anyaddr(bool seal)
 
        }
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 
@@ -1556,7 +1556,7 @@ static void test_seal_merge_and_split(void)
        FAIL_TEST_IF_FALSE(size ==  22 * page_size);
        FAIL_TEST_IF_FALSE(prot == 0x4);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_discard_ro_anon_on_rw(bool seal)
@@ -1585,7 +1585,7 @@ static void test_seal_discard_ro_anon_on_rw(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_discard_ro_anon_on_pkey(bool seal)
@@ -1632,7 +1632,7 @@ static void test_seal_discard_ro_anon_on_pkey(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_discard_ro_anon_on_filebacked(bool seal)
@@ -1669,7 +1669,7 @@ static void test_seal_discard_ro_anon_on_filebacked(bool seal)
                FAIL_TEST_IF_FALSE(!ret);
        close(fd);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_discard_ro_anon_on_shared(bool seal)
@@ -1698,7 +1698,7 @@ static void test_seal_discard_ro_anon_on_shared(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 static void test_seal_discard_ro_anon(bool seal)
@@ -1728,7 +1728,7 @@ static void test_seal_discard_ro_anon(bool seal)
        else
                FAIL_TEST_IF_FALSE(!ret);
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 int main(int argc, char **argv)
index 45c73213775b8cf65a7e5c57378e6ec12d2de53a..7aa1366063e4e4033d46a5dbca26303478073013 100644 (file)
@@ -127,7 +127,7 @@ static void test_seal_elf(void)
        FAIL_TEST_IF_FALSE(ret < 0);
        ksft_print_msg("somestr is sealed, mprotect is rejected\n");
 
-       TEST_END_CHECK();
+       REPORT_TEST_PASS();
 }
 
 int main(int argc, char **argv)