64 lines
2.8 KiB
Diff
64 lines
2.8 KiB
Diff
From c9fe9526f07ad24d29842fa853ee458b68660896 Mon Sep 17 00:00:00 2001
|
|
From: Frantisek Sumsal <frantisek@sumsal.cz>
|
|
Date: Fri, 22 Apr 2022 18:03:14 +0200
|
|
Subject: [PATCH] test: extend the "hashed" unit names coverage a bit
|
|
|
|
Follow-up to #22759.
|
|
|
|
(cherry picked from commit 98f8c316389177169c6599e67010ebb1789a6b26)
|
|
|
|
Related: #2083493
|
|
---
|
|
test/units/testsuite-64.sh | 19 ++++++++++++++++---
|
|
1 file changed, 16 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh
|
|
index 218b2ee8d1..5f9aeee261 100755
|
|
--- a/test/units/testsuite-64.sh
|
|
+++ b/test/units/testsuite-64.sh
|
|
@@ -646,7 +646,7 @@ testcase_iscsi_lvm() {
|
|
}
|
|
|
|
testcase_long_sysfs_path() {
|
|
- local link logfile mpoint
|
|
+ local cursor link logfile mpoint
|
|
local expected_symlinks=(
|
|
"/dev/disk/by-label/data_vol"
|
|
"/dev/disk/by-label/swap_vol"
|
|
@@ -657,6 +657,12 @@ testcase_long_sysfs_path() {
|
|
"/dev/disk/by-uuid/deadbeef-dead-dead-beef-222222222222"
|
|
)
|
|
|
|
+ # Create a cursor file to skip messages generated by udevd in initrd, as it
|
|
+ # might not be the same up-to-date version as we currently run (hence generating
|
|
+ # messages we check for later and making the test fail)
|
|
+ cursor="$(mktemp)"
|
|
+ journalctl --cursor-file="${cursor:?}" -n0 -q
|
|
+
|
|
# Make sure the test device is connected and show its "wonderful" path
|
|
stat /sys/block/vda
|
|
readlink -f /sys/block/vda/dev
|
|
@@ -685,13 +691,20 @@ testcase_long_sysfs_path() {
|
|
udevadm settle
|
|
|
|
logfile="$(mktemp)"
|
|
- [[ "$(journalctl -b -q --no-pager -o short-monotonic -p info --grep "Device path.*vda.?' too long to fit into unit name" | wc -l)" -eq 0 ]]
|
|
+ # Check state of affairs after https://github.com/systemd/systemd/pull/22759
|
|
+ # Note: can't use `--cursor-file` here, since we don't want to update the cursor
|
|
+ # after using it
|
|
+ [[ "$(journalctl --after-cursor="$(<"$cursor")" -q --no-pager -o short-monotonic -p info --grep "Device path.*vda.?' too long to fit into unit name" | wc -l)" -eq 0 ]]
|
|
+ [[ "$(journalctl --after-cursor="$(<"$cursor")" -q --no-pager -o short-monotonic --grep "Unit name .*vda.?\.device\" too long, falling back to hashed unit name" | wc -l)" -gt 0 ]]
|
|
+ # Check if the respective "hashed" units exist and are active (plugged)
|
|
+ systemctl status --no-pager "$(readlink -f /sys/block/vda/vda1)"
|
|
+ systemctl status --no-pager "$(readlink -f /sys/block/vda/vda2)"
|
|
# Make sure we don't unnecessarily spam the log
|
|
{ journalctl -b -q --no-pager -o short-monotonic -p info --grep "/sys/devices/.+/vda[0-9]?" _PID=1 + UNIT=systemd-udevd.service || :;} | tee "$logfile"
|
|
[[ "$(wc -l <"$logfile")" -lt 10 ]]
|
|
|
|
: >/etc/fstab
|
|
- rm -fr "${logfile:?}" "${mpoint:?}"
|
|
+ rm -fr "${cursor:?}" "${logfile:?}" "${mpoint:?}"
|
|
}
|
|
|
|
: >/failed
|