Commit 13b180a
committed
TestSELinux: use LockOSThread to avoid flakes
The SetFSCreateLabel documentation says the caller should use
runtime.LockOSThread. Indeed, if not used, there is an occasional flake:
> $ go test -run TestSELinux -count 10000 .
> selinux_linux_test.go:168: SetFSCreateLabel failed write /proc/thread-self/attr/fscreate: permission denied
> selinux_linux_test.go:169: write /proc/thread-self/attr/fscreate: permission denied
Add LockOSThread to fix the flake.
While at it, simplify code flow to avoid using "else", and fix logging
to avoid printing the same error twice.
Signed-off-by: Kir Kolyshkin <[email protected]>1 parent 03cde75 commit 13b180a
1 file changed
+14
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
235 | 236 | | |
236 | 237 | | |
237 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
238 | 245 | | |
239 | 246 | | |
240 | 247 | | |
| |||
259 | 266 | | |
260 | 267 | | |
261 | 268 | | |
262 | | - | |
| 269 | + | |
263 | 270 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
| 271 | + | |
| 272 | + | |
269 | 273 | | |
| 274 | + | |
270 | 275 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 276 | + | |
| 277 | + | |
276 | 278 | | |
| 279 | + | |
277 | 280 | | |
278 | 281 | | |
279 | 282 | | |
| |||
0 commit comments