[PATCH] UBUNTU SAUCE: autotest: ubuntu_xfstests_[btrfs|ext4|xfs]: xfstests: fix handling of loop partitions
Paolo Pisati
paolo.pisati at canonical.com
Thu Apr 9 11:12:34 UTC 2020
BugLink: https://bugs.launchpad.net/bugs/1871826
Partitions on loop devices have a 'p' prefix, contrary to partition on real
devices (e.g. /dev/loop0p1 vs /dev/sda1) and the
create-test-partitions script, common to all xfs* tests, fails to recognize
loop devices, and thus fail to handle their difference:
$ dd if=/dev/zero of=~/test.img bs=1G count=128
$ sudo losetup -f ~/test.img
$ sudo autotest/client/autotest-local -a UBUNTU_SCRATCH_DEVICE=/dev/loop4 autotest/client/tests/ubuntu_xfstests_ext4/control.ubuntu
...
10:37:10 INFO | /bin/bash
/home/ubuntu/k-testing/autotest/client/tests/ubuntu_xfstests_ext4/create-test-partitions
/dev/loop4 ext4
10:38:11 ERROR| [stderr] mke2fs 1.45.5 (07-Jan-2020)
10:38:11 ERROR| [stderr] The file /dev/loop41 does not exist and no size was specified.
10:38:11 ERROR| Exception escaping from test:
Traceback (most recent call last):
...
CmdError: Command </bin/bash
/home/ubuntu/k-testing/autotest/client/tests/ubuntu_xfstests_ext4/create-test-partitions
/dev/loop4 ext4> failed, rc=1, Com mand returned non-zero exit status
* Command:
/bin/bash
/home/ubuntu/k-testing/autotest/client/tests/ubuntu_xfstests_ext4/create-
test-partitions /dev/loop4 ext4
Exit status: 1
Duration: 61.6367790699
Fix it by teaching create-test-partitions how to recognize (and handle), loop
device partitions.
Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
---
ubuntu_xfstests_btrfs/create-test-partitions | 2 ++
ubuntu_xfstests_ext4/create-test-partitions | 2 ++
ubuntu_xfstests_xfs/create-test-partitions | 2 ++
xfstests/create-test-partitions | 2 ++
4 files changed, 8 insertions(+)
diff --git a/ubuntu_xfstests_btrfs/create-test-partitions b/ubuntu_xfstests_btrfs/create-test-partitions
index d02a8b6e..089bea6e 100644
--- a/ubuntu_xfstests_btrfs/create-test-partitions
+++ b/ubuntu_xfstests_btrfs/create-test-partitions
@@ -48,6 +48,8 @@ fi
sleep 60 # Give things a minute to settle before creating new partitions
+[[ $DEVICE =~ ^/dev/loop[0-9]{1,}$ ]] && DEVICE=${DEVICE}p
+
for i in `seq 1 5`
do
sudo mkfs.$FS $FS_OPT ${DEVICE}$i
diff --git a/ubuntu_xfstests_ext4/create-test-partitions b/ubuntu_xfstests_ext4/create-test-partitions
index d02a8b6e..089bea6e 100644
--- a/ubuntu_xfstests_ext4/create-test-partitions
+++ b/ubuntu_xfstests_ext4/create-test-partitions
@@ -48,6 +48,8 @@ fi
sleep 60 # Give things a minute to settle before creating new partitions
+[[ $DEVICE =~ ^/dev/loop[0-9]{1,}$ ]] && DEVICE=${DEVICE}p
+
for i in `seq 1 5`
do
sudo mkfs.$FS $FS_OPT ${DEVICE}$i
diff --git a/ubuntu_xfstests_xfs/create-test-partitions b/ubuntu_xfstests_xfs/create-test-partitions
index d02a8b6e..089bea6e 100644
--- a/ubuntu_xfstests_xfs/create-test-partitions
+++ b/ubuntu_xfstests_xfs/create-test-partitions
@@ -48,6 +48,8 @@ fi
sleep 60 # Give things a minute to settle before creating new partitions
+[[ $DEVICE =~ ^/dev/loop[0-9]{1,}$ ]] && DEVICE=${DEVICE}p
+
for i in `seq 1 5`
do
sudo mkfs.$FS $FS_OPT ${DEVICE}$i
diff --git a/xfstests/create-test-partitions b/xfstests/create-test-partitions
index d02a8b6e..089bea6e 100644
--- a/xfstests/create-test-partitions
+++ b/xfstests/create-test-partitions
@@ -48,6 +48,8 @@ fi
sleep 60 # Give things a minute to settle before creating new partitions
+[[ $DEVICE =~ ^/dev/loop[0-9]{1,}$ ]] && DEVICE=${DEVICE}p
+
for i in `seq 1 5`
do
sudo mkfs.$FS $FS_OPT ${DEVICE}$i
--
2.25.1
More information about the kernel-team
mailing list