mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #30656 from mrc0mmand/dfuzzer-shenanigans
test: avoid starting/stopping unwanted units during fuzzing
This commit is contained in:
@@ -1840,7 +1840,8 @@ save_journal() {
|
||||
# Show messages from the testsuite-XX.service or messages with priority "warning" and higher
|
||||
echo " --- $source_dir ---"
|
||||
"$JOURNALCTL" --no-pager --no-hostname -o short-monotonic -D "$source_dir" \
|
||||
_SYSTEMD_UNIT="testsuite-${TESTID:?}.service" + PRIORITY=4 + PRIORITY=3 + PRIORITY=2 + PRIORITY=1 + PRIORITY=0
|
||||
_SYSTEMD_UNIT="testsuite-${TESTID:?}.service" + SYSLOG_IDENTIFIER="testsuite-$TESTID.sh" + \
|
||||
PRIORITY=4 + PRIORITY=3 + PRIORITY=2 + PRIORITY=1 + PRIORITY=0
|
||||
|
||||
if get_bool "$save"; then
|
||||
# If we don't have systemd-journal-remote copy all journals from /var/log/journal/
|
||||
|
||||
@@ -21,16 +21,32 @@ at_exit() {
|
||||
fi
|
||||
}
|
||||
|
||||
add_suppression() {
|
||||
local interface="${1:?}"
|
||||
local suppression="${2:?}"
|
||||
|
||||
sed -i "\%\[$interface\]%a$suppression" /etc/dfuzzer.conf
|
||||
}
|
||||
|
||||
trap at_exit EXIT
|
||||
|
||||
systemctl log-level info
|
||||
|
||||
# FIXME: systemd-run doesn't play well with daemon-reexec
|
||||
# See: https://github.com/systemd/systemd/issues/27204
|
||||
sed -i '/\[org.freedesktop.systemd1\]/aorg.freedesktop.systemd1.Manager:Reexecute FIXME' /etc/dfuzzer.conf
|
||||
add_suppression "org.freedesktop.systemd1" "org.freedesktop.systemd1.Manager:Reexecute FIXME"
|
||||
|
||||
sed -i '/\[org.freedesktop.systemd1\]/aorg.freedesktop.systemd1.Manager:SoftReboot destructive' /etc/dfuzzer.conf
|
||||
sed -i '/\[org.freedesktop.login1\]/aSleep destructive' /etc/dfuzzer.conf
|
||||
add_suppression "org.freedesktop.systemd1" "org.freedesktop.systemd1.Manager:SoftReboot destructive"
|
||||
add_suppression "org.freedesktop.login1" "Sleep destructive"
|
||||
|
||||
# Skip calling start and stop methods on unit objects, as doing that is not only time consuming, but it also
|
||||
# starts/stops units that interfere with the machine state. The actual code paths should be covered (to some
|
||||
# degree) by the respective method counterparts on the manager object.
|
||||
for method in Start Stop Restart ReloadOrRestart ReloadOrTryRestart Kill; do
|
||||
add_suppression "org.freedesktop.systemd1" "org.freedesktop.systemd1.Unit:$method"
|
||||
done
|
||||
|
||||
cat /etc/dfuzzer.conf
|
||||
|
||||
# TODO
|
||||
# * check for possibly newly introduced buses?
|
||||
|
||||
Reference in New Issue
Block a user