1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

test: skip the hwdb update related tests w/ sanitizers and w/o accel

systemd-hwdb update is an expensive operation by itself, and when
running with sanitizers and in a VM without acceleration this cost is
exacerbated even further, making the test run for a very long time.

For example, in the daily CentOS CI ppc64le job with ASan+UBSan one
systemd-hwdb update takes more than 7 minutes; in the regular Arch job
with KVM it takes over 2 minutes.

Since the hwdb update is also tested in other places (like
TEST-01-BASIC and the test-hwdb meson test), let's skip it if we detect
we run with sanitizers and with plain QEMU.
This commit is contained in:
Frantisek Sumsal 2023-03-01 11:06:42 +01:00
parent 8c7a6c742a
commit ea91b45e0e

View File

@ -11,10 +11,6 @@ set -o pipefail
cleanup_17_10() {
set +e
rmmod scsi_debug
rm -f /etc/udev/hwdb.d/99-test.hwdb
systemd-hwdb update
losetup -d "$loopdev"
rm -f "$blk"
@ -33,14 +29,6 @@ blk="$(mktemp)"
dd if=/dev/null of="$blk" bs=1M count=1
loopdev="$(losetup --show -f "$blk")"
modprobe scsi_debug
scsidev=$(readlink -f /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/[0-9]*)
cat > /etc/udev/hwdb.d/99-test.hwdb <<EOF
scsi:*
ID_TEST=test
EOF
systemd-hwdb update
udevadm -h
udevadm control -l emerg
@ -138,13 +126,31 @@ udevadm test-builtin -a unbind net_id /sys/class/net/$netdev
udevadm test-builtin -a help net_id /sys/class/net/$netdev
udevadm test-builtin net_setup_link /sys/class/net/$netdev
udevadm test-builtin blkid "$loopdev"
udevadm test-builtin hwdb "$scsidev"
udevadm test-builtin input_id /sys/class/net/$netdev
udevadm test-builtin keyboard /dev/null
# udevadm test-builtin kmod /sys/class/net/$netdev
udevadm test-builtin uaccess /dev/null
# udevadm test-builtin usb_id dev/null
(! udevadm test-builtin hello /sys/class/net/$netdev )
# systemd-hwdb update is extremely slow when combined with sanitizers and run
# in a VM without acceleration, so let's just skip the one particular test
# if we detect this combination
if ! [[ -v ASAN_OPTIONS && "$(systemd-detect-virt -v)" == "qemu" ]]; then
modprobe scsi_debug
scsidev=$(readlink -f /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/[0-9]*)
cat > /etc/udev/hwdb.d/99-test.hwdb <<EOF
scsi:*
ID_TEST=test
EOF
systemd-hwdb update
udevadm test-builtin hwdb "$scsidev"
rmmod scsi_debug
rm -f /etc/udev/hwdb.d/99-test.hwdb
systemd-hwdb update
fi
udevadm trigger
udevadm trigger /dev/null