mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-14 01:57:27 +03:00
udev before #30532 may kill the worker process together with a slow program, and when running with sanitizers the resulting coredump might be too big to fit into journal (or the space currently available for journal): [ 30.086194] systemd-journald[330]: Failed to write entry to /var/log/journal/e87de9ccbacf4b88924ff6d9ecaaa82d/system.journal (50 items, 68326399 bytes) despite vacuuming, ignoring: Argument list too long This then makes the test fail, as it checks for the presence of the coredump. Since we don't really care about the coredump in this specific case (as it is an expected one), let's just temporarily override the testsuite-wide Storage=journal and store the coredumps externally. This is a v255-stable-only patch, since after #30532 the test no longer checks for coredumps.
76 lines
1.9 KiB
Bash
Executable File
76 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
set -ex
|
|
|
|
TEST_RULE="/run/udev/rules.d/49-test.rules"
|
|
KILL_PID=
|
|
|
|
setup() {
|
|
mkdir -p "${TEST_RULE%/*}"
|
|
[[ -e /etc/udev/udev.conf ]] && cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bak
|
|
# Don't bother storing the coredumps in journal for this particular test
|
|
mkdir -p /run/systemd/coredump.conf.d/
|
|
echo -ne "[Coredump]\nStorage=external\n" >/run/systemd/coredump.conf.d/99-storage-journal.conf
|
|
|
|
cat >"${TEST_RULE}" <<EOF
|
|
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", OPTIONS="log_level=debug"
|
|
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", PROGRAM=="/bin/sleep 60"
|
|
EOF
|
|
cat >/etc/udev/udev.conf <<EOF
|
|
event_timeout=10
|
|
timeout_signal=SIGABRT
|
|
EOF
|
|
|
|
systemctl restart systemd-udevd.service
|
|
}
|
|
|
|
# shellcheck disable=SC2317
|
|
teardown() {
|
|
set +e
|
|
|
|
if [[ -n "$KILL_PID" ]]; then
|
|
kill "$KILL_PID"
|
|
fi
|
|
|
|
rm -rf "$TMPDIR"
|
|
rm -f "$TEST_RULE"
|
|
[[ -e /etc/udev/udev.conf.bak ]] && mv -f /etc/udev/udev.conf.bak /etc/udev/udev.conf
|
|
rm /run/systemd/coredump.conf.d/99-storage-journal.conf
|
|
systemctl restart systemd-udevd.service
|
|
}
|
|
|
|
run_test() {
|
|
local since
|
|
|
|
since="$(date '+%F %T')"
|
|
|
|
TMPDIR=$(mktemp -d -p /tmp udev-tests.XXXXXX)
|
|
udevadm monitor --udev --property --subsystem-match=mem >"$TMPDIR"/monitor.txt &
|
|
KILL_PID="$!"
|
|
|
|
SYSTEMD_LOG_LEVEL=debug udevadm trigger --verbose --action add /dev/null
|
|
|
|
for _ in {1..40}; do
|
|
if coredumpctl --since "$since" --no-legend --no-pager | grep /bin/udevadm ; then
|
|
kill "$KILL_PID"
|
|
KILL_PID=
|
|
|
|
cat "$TMPDIR"/monitor.txt
|
|
grep -q 'UDEV_WORKER_FAILED=1' "$TMPDIR"/monitor.txt
|
|
grep -q 'UDEV_WORKER_SIGNAL=6' "$TMPDIR"/monitor.txt
|
|
grep -q 'UDEV_WORKER_SIGNAL_NAME=ABRT' "$TMPDIR"/monitor.txt
|
|
return 0
|
|
fi
|
|
sleep .5
|
|
done
|
|
|
|
return 1
|
|
}
|
|
|
|
trap teardown EXIT
|
|
|
|
setup
|
|
run_test
|
|
|
|
exit 0
|