]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-17-UDEV: check if udev database file is removed on remove event 34752/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 13 Oct 2024 16:28:23 +0000 (01:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 15 Oct 2024 01:51:25 +0000 (10:51 +0900)
test/units/TEST-17-UDEV.database.sh [new file with mode: 0755]

diff --git a/test/units/TEST-17-UDEV.database.sh b/test/units/TEST-17-UDEV.database.sh
new file mode 100755 (executable)
index 0000000..2b66333
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -ex
+set -o pipefail
+
+udevadm control --log-level=debug
+
+IFNAME=test-udev-aaa
+ip link add "$IFNAME" type dummy
+IFINDEX=$(ip -json link show "$IFNAME" | jq '.[].ifindex')
+udevadm wait --timeout 10 "/sys/class/net/$IFNAME"
+# Check if the database file is created.
+[[ -e "/run/udev/data/n$IFINDEX" ]]
+
+ip link del "$IFNAME"
+udevadm wait --timeout 10 --removed --settle "/sys/class/net/$IFNAME"
+# CHeck if the database file is removed.
+[[ ! -e "/run/udev/data/n$IFINDEX" ]]
+
+udevadm control --log-level=info
+
+exit 0