-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: kern: add some tests for recently added logsigexit
We don't bother tweaking the sysctl in these tests, we'll just try with it forced both on and off via proccontrol(1). This could be problematic in the face of pid wrapping if we got really unfortunate, but the potential solutions need careful consideration- you probably don't want to assume a certain velocity of messages into syslog, so just checking the last N lines is probably similarly flakey.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Copyright (c) 2024 Kyle Evans <[email protected]> | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
|
||
atf_test_case basic | ||
basic_body() | ||
{ | ||
|
||
# SIGABRT carefully chosen to avoid issues when run under Kyua. No | ||
# matter the value of the global kern.logsigexit, these should force | ||
# the messages as appropriate and we'll all be happy. | ||
proccontrol -m logsigexit -s enable \ | ||
sh -c 'echo $$ > enabled.out; kill -ABRT $$' | ||
proccontrol -m logsigexit -s disable \ | ||
sh -c 'echo $$ > disabled.out; kill -ABRT $$' | ||
|
||
atf_check test -s enabled.out | ||
atf_check test -s disabled.out | ||
|
||
read enpid < enabled.out | ||
read dispid < disabled.out | ||
|
||
1>&2 echo "$enpid" | ||
1>&2 echo "$dispid" | ||
|
||
atf_check grep -Eq "$enpid.+exited on signal" /var/log/messages | ||
atf_check -s not-exit:0 \ | ||
grep -Eq "$dispid.+exited on signal" /var/log/messages | ||
} | ||
|
||
atf_init_test_cases() | ||
{ | ||
atf_add_test_case basic | ||
} |