Commit 3aff514
selftests/resctrl: Extend signal handler coverage to unmount on receiving signal
Unmounting resctrl FS has been moved into the per test functions in
resctrl_tests.c by commit caddc0f ("selftests/resctrl: Move
resctrl FS mount/umount to higher level"). In case a signal (SIGINT,
SIGTERM, or SIGHUP) is received, the running selftest is aborted by
ctrlc_handler() which then unmounts resctrl fs before exiting. The
current section between signal_handler_register() and
signal_handler_unregister(), however, does not cover the entire
duration when resctrl FS is mounted.
Move signal_handler_register() and signal_handler_unregister() calls
from per test files into resctrl_tests.c to properly unmount resctrl
fs. In order to not add signal_handler_register()/unregister() n times,
create helpers test_prepare() and test_cleanup().
Do not call ksft_exit_fail_msg() in test_prepare() but only in the per
test function to keep the control flow cleaner without adding calls to
exit() deep into the call chain.
Adjust child process kill() call in ctrlc_handler() to only be invoked
if the child was already forked.
Fixes: caddc0f ("selftests/resctrl: Move resctrl FS mount/umount to higher level")
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>1 parent beb7f47 commit 3aff514
3 files changed
Lines changed: 55 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | 170 | | |
177 | 171 | | |
178 | 172 | | |
| |||
209 | 203 | | |
210 | 204 | | |
211 | 205 | | |
212 | | - | |
213 | 206 | | |
214 | 207 | | |
215 | | - | |
216 | 208 | | |
217 | 209 | | |
218 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
78 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
79 | 103 | | |
80 | 104 | | |
81 | 105 | | |
82 | 106 | | |
83 | 107 | | |
84 | | - | |
| 108 | + | |
85 | 109 | | |
86 | 110 | | |
87 | 111 | | |
88 | 112 | | |
89 | 113 | | |
90 | 114 | | |
91 | 115 | | |
92 | | - | |
93 | | - | |
| 116 | + | |
| 117 | + | |
94 | 118 | | |
95 | 119 | | |
96 | 120 | | |
| |||
99 | 123 | | |
100 | 124 | | |
101 | 125 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 126 | + | |
| 127 | + | |
105 | 128 | | |
106 | 129 | | |
107 | 130 | | |
108 | 131 | | |
109 | 132 | | |
110 | | - | |
| 133 | + | |
111 | 134 | | |
112 | 135 | | |
113 | 136 | | |
114 | 137 | | |
115 | 138 | | |
116 | | - | |
117 | | - | |
| 139 | + | |
| 140 | + | |
118 | 141 | | |
119 | 142 | | |
120 | 143 | | |
| |||
123 | 146 | | |
124 | 147 | | |
125 | 148 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 149 | + | |
| 150 | + | |
129 | 151 | | |
130 | 152 | | |
131 | 153 | | |
132 | 154 | | |
133 | 155 | | |
134 | | - | |
| 156 | + | |
135 | 157 | | |
136 | 158 | | |
137 | 159 | | |
138 | 160 | | |
139 | 161 | | |
140 | 162 | | |
141 | 163 | | |
142 | | - | |
143 | | - | |
| 164 | + | |
| 165 | + | |
144 | 166 | | |
145 | 167 | | |
146 | 168 | | |
| |||
149 | 171 | | |
150 | 172 | | |
151 | 173 | | |
152 | | - | |
153 | | - | |
154 | | - | |
| 174 | + | |
| 175 | + | |
155 | 176 | | |
156 | 177 | | |
157 | 178 | | |
158 | 179 | | |
159 | 180 | | |
160 | | - | |
| 181 | + | |
161 | 182 | | |
162 | 183 | | |
163 | 184 | | |
164 | 185 | | |
165 | 186 | | |
166 | | - | |
167 | | - | |
| 187 | + | |
| 188 | + | |
168 | 189 | | |
169 | 190 | | |
170 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
472 | 474 | | |
473 | 475 | | |
474 | 476 | | |
| |||
485 | 487 | | |
486 | 488 | | |
487 | 489 | | |
| 490 | + | |
| 491 | + | |
488 | 492 | | |
489 | 493 | | |
490 | 494 | | |
| |||
706 | 710 | | |
707 | 711 | | |
708 | 712 | | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
724 | | - | |
| 724 | + | |
725 | 725 | | |
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
730 | | - | |
| 730 | + | |
731 | 731 | | |
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
735 | 735 | | |
736 | | - | |
| 736 | + | |
737 | 737 | | |
738 | 738 | | |
739 | 739 | | |
| |||
748 | 748 | | |
749 | 749 | | |
750 | 750 | | |
751 | | - | |
| 751 | + | |
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
| |||
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
760 | | - | |
| 760 | + | |
761 | 761 | | |
762 | 762 | | |
763 | 763 | | |
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
789 | | - | |
790 | | - | |
791 | 789 | | |
792 | 790 | | |
793 | 791 | | |
| |||
0 commit comments