Commit 0710a1a
selftests/harness: Merge TEST_F_FORK() into TEST_F()
Replace Landlock-specific TEST_F_FORK() with an improved TEST_F() which
brings four related changes:
Run TEST_F()'s tests in a grandchild process to make it possible to
drop privileges and delegate teardown to the parent.
Compared to TEST_F_FORK(), simplify handling of the test grandchild
process thanks to vfork(2), and makes it generic (e.g. no explicit
conversion between exit code and _metadata).
Compared to TEST_F_FORK(), run teardown even when tests failed with an
assert thanks to commit 63e6b2a ("selftests/harness: Run TEARDOWN
for ASSERT failures").
Simplify the test harness code by removing the no_print and step fields
which are not used. I added this feature just after I made
kselftest_harness.h more broadly available but this step counter
remained even though it wasn't needed after all. See commit 369130b
("selftests: Enhance kselftest_harness.h to print which assert failed").
Replace spaces with tabs in one line of __TEST_F_IMPL().
Cc: Günther Noack <gnoack@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Will Drewry <wad@chromium.org>
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent e740486 commit 0710a1a
File tree
2 files changed
+27
-91
lines changed- tools/testing/selftests
- landlock
2 files changed
+27
-91
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | 98 | | |
107 | 99 | | |
108 | 100 | | |
| |||
363 | 355 | | |
364 | 356 | | |
365 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
366 | 363 | | |
367 | 364 | | |
368 | 365 | | |
| |||
384 | 381 | | |
385 | 382 | | |
386 | 383 | | |
| 384 | + | |
387 | 385 | | |
388 | 386 | | |
389 | 387 | | |
390 | 388 | | |
391 | | - | |
| 389 | + | |
392 | 390 | | |
393 | 391 | | |
394 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
395 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
396 | 406 | | |
397 | 407 | | |
398 | 408 | | |
| |||
694 | 704 | | |
695 | 705 | | |
696 | 706 | | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | 707 | | |
703 | 708 | | |
704 | 709 | | |
705 | 710 | | |
706 | 711 | | |
707 | 712 | | |
708 | | - | |
709 | 713 | | |
710 | 714 | | |
711 | 715 | | |
| |||
751 | 755 | | |
752 | 756 | | |
753 | 757 | | |
754 | | - | |
755 | 758 | | |
756 | 759 | | |
757 | 760 | | |
| |||
837 | 840 | | |
838 | 841 | | |
839 | 842 | | |
840 | | - | |
841 | | - | |
842 | 843 | | |
843 | 844 | | |
844 | 845 | | |
| |||
873 | 874 | | |
874 | 875 | | |
875 | 876 | | |
876 | | - | |
877 | | - | |
878 | | - | |
| 877 | + | |
879 | 878 | | |
880 | | - | |
881 | 879 | | |
882 | 880 | | |
883 | 881 | | |
| |||
954 | 952 | | |
955 | 953 | | |
956 | 954 | | |
957 | | - | |
| 955 | + | |
958 | 956 | | |
959 | 957 | | |
960 | 958 | | |
961 | | - | |
962 | | - | |
963 | | - | |
| 959 | + | |
| 960 | + | |
964 | 961 | | |
965 | 962 | | |
966 | 963 | | |
| |||
1114 | 1111 | | |
1115 | 1112 | | |
1116 | 1113 | | |
1117 | | - | |
1118 | | - | |
1119 | 1114 | | |
1120 | 1115 | | |
1121 | 1116 | | |
| |||
1137 | 1132 | | |
1138 | 1133 | | |
1139 | 1134 | | |
1140 | | - | |
1141 | | - | |
| 1135 | + | |
1142 | 1136 | | |
1143 | 1137 | | |
1144 | 1138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 26 | + | |
| 27 | + | |
86 | 28 | | |
87 | 29 | | |
88 | 30 | | |
| |||
0 commit comments