]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-17-UDEV: also check if /run/udev/links.lock/ is empty on settle 34698/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 10 Oct 2024 18:37:01 +0000 (03:37 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 11 Oct 2024 20:34:29 +0000 (05:34 +0900)
test/units/TEST-17-UDEV.diskseq.sh

index 1aafbe9834c768ac0de936fb8a173a27c3f653ad..53ee666984f6320d9161fe505a2f4a0facde32b6 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 # shellcheck disable=SC2010
+# shellcheck disable=SC2012
 # shellcheck disable=SC2317
 set -ex
 set -o pipefail
@@ -43,6 +44,11 @@ systemctl daemon-reload
 
 udevadm settle
 
+# Check if no lock file exists, if the lock directory exists.
+if [[ -d /run/udev/links.lock/ ]]; then
+    [[ "$(ls /run/udev/links.lock/ | wc -l)" == 0 ]]
+fi
+
 # Save the current number of the directories.
 NUM_DISKSEQ=$(ls /run/udev/links/ | grep -c by-diskseq || :)
 
@@ -54,4 +60,12 @@ for _ in {0..100}; do
     (( n <= NUM_DISKSEQ + 1 ))
 done
 
+systemctl stop test-diskseq.service || :
+
+udevadm settle
+
+# Check if the lock directory exists, but no lock file exists in it.
+[[ -d /run/udev/links.lock/ ]]
+[[ "$(ls /run/udev/links.lock/ | wc -l)" == 0 ]]
+
 exit 0