History

selftests/mm: mseal, self_elf: rename TEST_END_CHECK to REPORT_TEST_PASS

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.

John Hubbard committed 2 years ago

Commit eef07d61 parent 5f9b7513 files · +48 −48Browse files

Unified · Split

3 files
  1. tools/testing/selftests/mm/mseal_helpers.h +1 −1
  2. tools/testing/selftests/mm/mseal_test.c +46 −46
  3. tools/testing/selftests/mm/seal_elf.c +1 −1
tools/testing/selftests/mm/mseal_helpers.h+1−1
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818 } \
1919 } while (0)
2020
21−#define TEST_END_CHECK() ksft_test_result_pass("%s\n", __func__)
21+#define REPORT_TEST_PASS() ksft_test_result_pass("%s\n", __func__)
2222
2323 #ifndef PKEY_DISABLE_ACCESS
2424 #define PKEY_DISABLE_ACCESS 0x1
tools/testing/selftests/mm/mseal_test.c+46−46
@@ -240,7 +240,7 @@ static void test_seal_addseal(void) · 239 unmodified lines
240240 ret = sys_mseal(ptr, size);
241241 FAIL_TEST_IF_FALSE(!ret);
242242
243− TEST_END_CHECK();
243+ REPORT_TEST_PASS();
244244 }
245245
246246 static void test_seal_unmapped_start(void)
@@ -268,7 +268,7 @@ static void test_seal_unmapped_start(void) · 21 unmodified lines
268268 ret = sys_mseal(ptr + 2 * page_size, 2 * page_size);
269269 FAIL_TEST_IF_FALSE(!ret);
270270
271− TEST_END_CHECK();
271+ REPORT_TEST_PASS();
272272 }
273273
274274 static void test_seal_unmapped_middle(void)
@@ -300,7 +300,7 @@ static void test_seal_unmapped_middle(void) · 25 unmodified lines
300300 ret = sys_mseal(ptr + 3 * page_size, page_size);
301301 FAIL_TEST_IF_FALSE(!ret);
302302
303− TEST_END_CHECK();
303+ REPORT_TEST_PASS();
304304 }
305305
306306 static void test_seal_unmapped_end(void)
@@ -329,7 +329,7 @@ static void test_seal_unmapped_end(void) · 22 unmodified lines
329329 ret = sys_mseal(ptr, 2 * page_size);
330330 FAIL_TEST_IF_FALSE(!ret);
331331
332− TEST_END_CHECK();
332+ REPORT_TEST_PASS();
333333 }
334334
335335 static void test_seal_multiple_vmas(void)
@@ -360,7 +360,7 @@ static void test_seal_multiple_vmas(void) · 24 unmodified lines
360360 ret = sys_mseal(ptr, size);
361361 FAIL_TEST_IF_FALSE(!ret);
362362
363− TEST_END_CHECK();
363+ REPORT_TEST_PASS();
364364 }
365365
366366 static void test_seal_split_start(void)
@@ -385,7 +385,7 @@ static void test_seal_split_start(void) · 18 unmodified lines
385385 ret = sys_mseal(ptr + page_size, 3 * page_size);
386386 FAIL_TEST_IF_FALSE(!ret);
387387
388− TEST_END_CHECK();
388+ REPORT_TEST_PASS();
389389 }
390390
391391 static void test_seal_split_end(void)
@@ -410,7 +410,7 @@ static void test_seal_split_end(void) · 18 unmodified lines
410410 ret = sys_mseal(ptr, 3 * page_size);
411411 FAIL_TEST_IF_FALSE(!ret);
412412
413− TEST_END_CHECK();
413+ REPORT_TEST_PASS();
414414 }
415415
416416 static void test_seal_invalid_input(void)
@@ -445,7 +445,7 @@ static void test_seal_invalid_input(void) · 28 unmodified lines
445445 ret = sys_mseal(ptr - page_size, 5 * page_size);
446446 FAIL_TEST_IF_FALSE(ret < 0);
447447
448− TEST_END_CHECK();
448+ REPORT_TEST_PASS();
449449 }
450450
451451 static void test_seal_zero_length(void)
@@ -469,7 +469,7 @@ static void test_seal_zero_length(void) · 17 unmodified lines
469469 ret = sys_mprotect(ptr, size, PROT_READ | PROT_WRITE);
470470 FAIL_TEST_IF_FALSE(!ret);
471471
472− TEST_END_CHECK();
472+ REPORT_TEST_PASS();
473473 }
474474
475475 static void test_seal_zero_address(void)
@@ -495,7 +495,7 @@ static void test_seal_zero_address(void) · 19 unmodified lines
495495 ret = sys_mprotect(ptr, size, PROT_READ | PROT_WRITE);
496496 FAIL_TEST_IF_FALSE(ret);
497497
498− TEST_END_CHECK();
498+ REPORT_TEST_PASS();
499499 }
500500
501501 static void test_seal_twice(void)
@@ -515,7 +515,7 @@ static void test_seal_twice(void) · 13 unmodified lines
515515 ret = sys_mseal(ptr, size);
516516 FAIL_TEST_IF_FALSE(!ret);
517517
518− TEST_END_CHECK();
518+ REPORT_TEST_PASS();
519519 }
520520
521521 static void test_seal_mprotect(bool seal)
@@ -539,7 +539,7 @@ static void test_seal_mprotect(bool seal) · 17 unmodified lines
539539 else
540540 FAIL_TEST_IF_FALSE(!ret);
541541
542− TEST_END_CHECK();
542+ REPORT_TEST_PASS();
543543 }
544544
545545 static void test_seal_start_mprotect(bool seal)
@@ -569,7 +569,7 @@ static void test_seal_start_mprotect(bool seal) · 23 unmodified lines
569569 PROT_READ | PROT_WRITE);
570570 FAIL_TEST_IF_FALSE(!ret);
571571
572− TEST_END_CHECK();
572+ REPORT_TEST_PASS();
573573 }
574574
575575 static void test_seal_end_mprotect(bool seal)
@@ -599,7 +599,7 @@ static void test_seal_end_mprotect(bool seal) · 23 unmodified lines
599599 else
600600 FAIL_TEST_IF_FALSE(!ret);
601601
602− TEST_END_CHECK();
602+ REPORT_TEST_PASS();
603603 }
604604
605605 static void test_seal_mprotect_unalign_len(bool seal)
@@ -628,7 +628,7 @@ static void test_seal_mprotect_unalign_len(bool seal) · 22 unmodified lines
628628 PROT_READ | PROT_WRITE);
629629 FAIL_TEST_IF_FALSE(!ret);
630630
631− TEST_END_CHECK();
631+ REPORT_TEST_PASS();
632632 }
633633
634634 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) · 21 unmodified lines
656656 PROT_READ | PROT_WRITE);
657657 FAIL_TEST_IF_FALSE(!ret);
658658
659− TEST_END_CHECK();
659+ REPORT_TEST_PASS();
660660 }
661661
662662 static void test_seal_mprotect_two_vma(bool seal)
@@ -691,7 +691,7 @@ static void test_seal_mprotect_two_vma(bool seal) · 28 unmodified lines
691691 else
692692 FAIL_TEST_IF_FALSE(!ret);
693693
694− TEST_END_CHECK();
694+ REPORT_TEST_PASS();
695695 }
696696
697697 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) · 40 unmodified lines
738738 PROT_READ | PROT_WRITE);
739739 FAIL_TEST_IF_FALSE(!ret);
740740
741− TEST_END_CHECK();
741+ REPORT_TEST_PASS();
742742 }
743743
744744 static void test_seal_mprotect_partial_mprotect(bool seal)
@@ -764,7 +764,7 @@ static void test_seal_mprotect_partial_mprotect(bool seal) · 19 unmodified lines
764764 else
765765 FAIL_TEST_IF_FALSE(!ret);
766766
767− TEST_END_CHECK();
767+ REPORT_TEST_PASS();
768768 }
769769
770770 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) · 36 unmodified lines
807807 ret = sys_mprotect(ptr + 3 * page_size, page_size, PROT_READ);
808808 FAIL_TEST_IF_FALSE(ret == 0);
809809
810− TEST_END_CHECK();
810+ REPORT_TEST_PASS();
811811 }
812812
813813 static void test_seal_mprotect_split(bool seal)
@@ -844,7 +844,7 @@ static void test_seal_mprotect_split(bool seal) · 30 unmodified lines
844844 else
845845 FAIL_TEST_IF_FALSE(!ret);
846846
847− TEST_END_CHECK();
847+ REPORT_TEST_PASS();
848848 }
849849
850850 static void test_seal_mprotect_merge(bool seal)
@@ -878,7 +878,7 @@ static void test_seal_mprotect_merge(bool seal) · 27 unmodified lines
878878 ret = sys_mprotect(ptr + 2 * page_size, 2 * page_size, PROT_READ);
879879 FAIL_TEST_IF_FALSE(ret == 0);
880880
881− TEST_END_CHECK();
881+ REPORT_TEST_PASS();
882882 }
883883
884884 static void test_seal_munmap(bool seal)
@@ -903,7 +903,7 @@ static void test_seal_munmap(bool seal) · 18 unmodified lines
903903 else
904904 FAIL_TEST_IF_FALSE(!ret);
905905
906− TEST_END_CHECK();
906+ REPORT_TEST_PASS();
907907 }
908908
909909 /*
@@ -943,7 +943,7 @@ static void test_seal_munmap_two_vma(bool seal) · 33 unmodified lines
943943 else
944944 FAIL_TEST_IF_FALSE(!ret);
945945
946− TEST_END_CHECK();
946+ REPORT_TEST_PASS();
947947 }
948948
949949 /*
@@ -981,7 +981,7 @@ static void test_seal_munmap_vma_with_gap(bool seal) · 31 unmodified lines
981981 ret = sys_munmap(ptr, size);
982982 FAIL_TEST_IF_FALSE(!ret);
983983
984− TEST_END_CHECK();
984+ REPORT_TEST_PASS();
985985 }
986986
987987 static void test_munmap_start_freed(bool seal)
@@ -1021,7 +1021,7 @@ static void test_munmap_start_freed(bool seal) · 33 unmodified lines
10211021 FAIL_TEST_IF_FALSE(size == 0);
10221022 }
10231023
1024− TEST_END_CHECK();
1024+ REPORT_TEST_PASS();
10251025 }
10261026
10271027 static void test_munmap_end_freed(bool seal)
@@ -1051,7 +1051,7 @@ static void test_munmap_end_freed(bool seal) · 23 unmodified lines
10511051 else
10521052 FAIL_TEST_IF_FALSE(!ret);
10531053
1054− TEST_END_CHECK();
1054+ REPORT_TEST_PASS();
10551055 }
10561056
10571057 static void test_munmap_middle_freed(bool seal)
@@ -1095,7 +1095,7 @@ static void test_munmap_middle_freed(bool seal) · 37 unmodified lines
10951095 FAIL_TEST_IF_FALSE(size == 0);
10961096 }
10971097
1098− TEST_END_CHECK();
1098+ REPORT_TEST_PASS();
10991099 }
11001100
11011101 static void test_seal_mremap_shrink(bool seal)
@@ -1124,7 +1124,7 @@ static void test_seal_mremap_shrink(bool seal) · 22 unmodified lines
11241124
11251125 }
11261126
1127− TEST_END_CHECK();
1127+ REPORT_TEST_PASS();
11281128 }
11291129
11301130 static void test_seal_mremap_expand(bool seal)
@@ -1156,7 +1156,7 @@ static void test_seal_mremap_expand(bool seal) · 25 unmodified lines
11561156
11571157 }
11581158
1159− TEST_END_CHECK();
1159+ REPORT_TEST_PASS();
11601160 }
11611161
11621162 static void test_seal_mremap_move(bool seal)
@@ -1189,7 +1189,7 @@ static void test_seal_mremap_move(bool seal) · 26 unmodified lines
11891189
11901190 }
11911191
1192− TEST_END_CHECK();
1192+ REPORT_TEST_PASS();
11931193 }
11941194
11951195 static void test_seal_mmap_overwrite_prot(bool seal)
@@ -1217,7 +1217,7 @@ static void test_seal_mmap_overwrite_prot(bool seal) · 21 unmodified lines
12171217 } else
12181218 FAIL_TEST_IF_FALSE(ret2 == ptr);
12191219
1220− TEST_END_CHECK();
1220+ REPORT_TEST_PASS();
12211221 }
12221222
12231223 static void test_seal_mmap_expand(bool seal)
@@ -1248,7 +1248,7 @@ static void test_seal_mmap_expand(bool seal) · 24 unmodified lines
12481248 } else
12491249 FAIL_TEST_IF_FALSE(ret2 == ptr);
12501250
1251− TEST_END_CHECK();
1251+ REPORT_TEST_PASS();
12521252 }
12531253
12541254 static void test_seal_mmap_shrink(bool seal)
@@ -1276,7 +1276,7 @@ static void test_seal_mmap_shrink(bool seal) · 21 unmodified lines
12761276 } else
12771277 FAIL_TEST_IF_FALSE(ret2 == ptr);
12781278
1279− TEST_END_CHECK();
1279+ REPORT_TEST_PASS();
12801280 }
12811281
12821282 static void test_seal_mremap_shrink_fixed(bool seal)
@@ -1307,7 +1307,7 @@ static void test_seal_mremap_shrink_fixed(bool seal) · 24 unmodified lines
13071307 } else
13081308 FAIL_TEST_IF_FALSE(ret2 == newAddr);
13091309
1310− TEST_END_CHECK();
1310+ REPORT_TEST_PASS();
13111311 }
13121312
13131313 static void test_seal_mremap_expand_fixed(bool seal)
@@ -1338,7 +1338,7 @@ static void test_seal_mremap_expand_fixed(bool seal) · 24 unmodified lines
13381338 } else
13391339 FAIL_TEST_IF_FALSE(ret2 == newAddr);
13401340
1341− TEST_END_CHECK();
1341+ REPORT_TEST_PASS();
13421342 }
13431343
13441344 static void test_seal_mremap_move_fixed(bool seal)
@@ -1368,7 +1368,7 @@ static void test_seal_mremap_move_fixed(bool seal) · 23 unmodified lines
13681368 } else
13691369 FAIL_TEST_IF_FALSE(ret2 == newAddr);
13701370
1371− TEST_END_CHECK();
1371+ REPORT_TEST_PASS();
13721372 }
13731373
13741374 static void test_seal_mremap_move_fixed_zero(bool seal)
@@ -1400,7 +1400,7 @@ static void test_seal_mremap_move_fixed_zero(bool seal) · 25 unmodified lines
14001400
14011401 }
14021402
1403− TEST_END_CHECK();
1403+ REPORT_TEST_PASS();
14041404 }
14051405
14061406 static void test_seal_mremap_move_dontunmap(bool seal)
@@ -1429,7 +1429,7 @@ static void test_seal_mremap_move_dontunmap(bool seal) · 22 unmodified lines
14291429
14301430 }
14311431
1432− TEST_END_CHECK();
1432+ REPORT_TEST_PASS();
14331433 }
14341434
14351435 static void test_seal_mremap_move_dontunmap_anyaddr(bool seal)
@@ -1463,7 +1463,7 @@ static void test_seal_mremap_move_dontunmap_anyaddr(bool seal) · 27 unmodified lines
14631463
14641464 }
14651465
1466− TEST_END_CHECK();
1466+ REPORT_TEST_PASS();
14671467 }
14681468
14691469
@@ -1556,7 +1556,7 @@ static void test_seal_merge_and_split(void) · 86 unmodified lines
15561556 FAIL_TEST_IF_FALSE(size == 22 * page_size);
15571557 FAIL_TEST_IF_FALSE(prot == 0x4);
15581558
1559− TEST_END_CHECK();
1559+ REPORT_TEST_PASS();
15601560 }
15611561
15621562 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) · 22 unmodified lines
15851585 else
15861586 FAIL_TEST_IF_FALSE(!ret);
15871587
1588− TEST_END_CHECK();
1588+ REPORT_TEST_PASS();
15891589 }
15901590
15911591 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) · 40 unmodified lines
16321632 else
16331633 FAIL_TEST_IF_FALSE(!ret);
16341634
1635− TEST_END_CHECK();
1635+ REPORT_TEST_PASS();
16361636 }
16371637
16381638 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) · 30 unmodified lines
16691669 FAIL_TEST_IF_FALSE(!ret);
16701670 close(fd);
16711671
1672− TEST_END_CHECK();
1672+ REPORT_TEST_PASS();
16731673 }
16741674
16751675 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) · 22 unmodified lines
16981698 else
16991699 FAIL_TEST_IF_FALSE(!ret);
17001700
1701− TEST_END_CHECK();
1701+ REPORT_TEST_PASS();
17021702 }
17031703
17041704 static void test_seal_discard_ro_anon(bool seal)
@@ -1728,7 +1728,7 @@ static void test_seal_discard_ro_anon(bool seal) · 23 unmodified lines
17281728 else
17291729 FAIL_TEST_IF_FALSE(!ret);
17301730
1731− TEST_END_CHECK();
1731+ REPORT_TEST_PASS();
17321732 }
17331733
17341734 int main(int argc, char **argv)
tools/testing/selftests/mm/seal_elf.c+1−1
@@ -127,7 +127,7 @@ static void test_seal_elf(void) · 126 unmodified lines
127127 FAIL_TEST_IF_FALSE(ret < 0);
128128 ksft_print_msg("somestr is sealed, mprotect is rejected\n");
129129
130− TEST_END_CHECK();
130+ REPORT_TEST_PASS();
131131 }
132132
133133 int main(int argc, char **argv)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t