]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-64-udev-storage: partition disk inside testcase - testcase_long_sysfs_path
authorSam Leonard <sam.leonard@codethink.co.uk>
Tue, 16 Apr 2024 12:18:34 +0000 (13:18 +0100)
committerSam Leonard <sam.leonard@codethink.co.uk>
Tue, 16 Apr 2024 15:18:36 +0000 (16:18 +0100)
test/TEST-64-UDEV-STORAGE/test.sh
test/test-functions
test/units/testsuite-64.sh

index b9e7bdf18ad14376d3c40ff11cedbc0114b38bf3..2b4927db0743e933c7afd582e62798e92f6c8f3a 100755 (executable)
@@ -475,18 +475,6 @@ testcase_long_sysfs_path() {
     )
 
     dd if=/dev/zero of="$testdisk" bs=1M count=64
-    lodev="$(losetup --show -f -P "$testdisk")"
-    sfdisk "${lodev:?}" <<EOF
-label: gpt
-
-name="test_swap", size=32M
-uuid="deadbeef-dead-dead-beef-000000000000", name="test_part", size=5M
-EOF
-    udevadm settle
-    mkswap -U "deadbeef-dead-dead-beef-111111111111" -L "swap_vol" "${lodev}p1"
-    mkfs.ext4 -U "deadbeef-dead-dead-beef-222222222222" -L "data_vol" "${lodev}p2"
-    losetup -d "$lodev"
-
     # Create 25 additional PCI bridges, each one connected to the previous one
     # (basically a really long extension cable), and attach a virtio drive to
     # the last one. This should force udev into attempting to create a device
index c62cf3d52182796088e53f58fc30b1426d0de1f1..67896fb30f6d3796862fcc96f50d8c7c56ca7186 100644 (file)
@@ -1117,6 +1117,9 @@ install_fs_tools() {
     # we use mkfs in system-repart tests
     image_install /sbin/mkfs.ext4
     image_install /sbin/mkfs.vfat
+
+    # we use mkswap in udev-storage tests
+    image_install /sbin/mkswap
 }
 
 install_modules() {
index 1123a1d33b1f22fc3e531595f7c92d5f92350fdb..fa823bce0c99499984bd64b04ae8c38e7047cc90 100755 (executable)
@@ -950,6 +950,16 @@ testcase_long_sysfs_path() {
     stat /sys/block/vda
     readlink -f /sys/block/vda/dev
 
+    dev="/dev/vda"
+    sfdisk "${dev:?}" <<EOF
+label: gpt
+
+name="test_swap", size=32M
+uuid="deadbeef-dead-dead-beef-000000000000", name="test_part", size=5M
+EOF
+    udevadm settle
+    mkswap -U "deadbeef-dead-dead-beef-111111111111" -L "swap_vol" "${dev}1"
+    mkfs.ext4 -U "deadbeef-dead-dead-beef-222222222222" -L "data_vol" "${dev}2"
     udevadm wait --settle --timeout=30 "${expected_symlinks[@]}"
 
     # Try to mount the data partition manually (using its label)