mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
test: escape '+' from uname -r before using in regex via '=~'
It will otherwise interpret characters such as '+' as if they
were regex, and break matching.
For example TEST-71-HOSTNAME started failing when
uname -r started including a '+':
FAIL: 'Kernel: Linux 6.12.33+deb13-amd64' not found in:
Static hostname: host
Icon name: computer-vm
Chassis: vm 🖴
Machine ID: e6471c1f95ab49098827498ed816cdf7
Boot ID: 231da987f64d4af59f2076fbb638c611
Virtualization: kvm
Operating System: Debian GNU/Linux 13 (trixie)
Kernel: Linux 6.12.33+deb13-amd64
Architecture: x86-64
This commit is contained in:
committed by
Yu Watanabe
parent
736b627775
commit
a0dfb02456
@@ -163,11 +163,11 @@ EOF
|
||||
udevadm control --reload
|
||||
|
||||
output=$(udevadm test --action add /sys/class/net/test1)
|
||||
assert_in "LINK_VERSION=$(uname -r)" "$output"
|
||||
assert_in "LINK_VERSION=$(uname -r | sed 's/\+/\\+/g')" "$output"
|
||||
|
||||
udevadm trigger --settle --action add /sys/class/net/test1
|
||||
output=$(udevadm info --query property /sys/class/net/test1)
|
||||
assert_in "LINK_VERSION=$(uname -r)" "$output"
|
||||
assert_in "LINK_VERSION=$(uname -r | sed 's/\+/\\+/g')" "$output"
|
||||
|
||||
# test for constant properties
|
||||
cat >/run/systemd/network/10-test.link.d/13-override.conf <<EOF
|
||||
|
||||
@@ -31,7 +31,7 @@ testcase_hostname() {
|
||||
if [[ -n "$orig" ]]; then
|
||||
assert_in "Static hostname: $orig" "$(hostnamectl)"
|
||||
fi
|
||||
assert_in "Kernel: $(uname -s) $(uname -r)" "$(hostnamectl)"
|
||||
assert_in "Kernel: $(uname -s) $(uname -r | sed 's/\+/\\+/g')" "$(hostnamectl)"
|
||||
|
||||
# change hostname
|
||||
assert_rc 0 hostnamectl set-hostname testhost
|
||||
|
||||
Reference in New Issue
Block a user