diff mbox series

UBUNTU SAUCE: autotest: ubuntu_xfstests_[btrfs|ext4|xfs]: xfstests: fix handling of loop partitions

Message ID 20200409111234.115151-1-paolo.pisati@canonical.com
State New
Headers show
Series UBUNTU SAUCE: autotest: ubuntu_xfstests_[btrfs|ext4|xfs]: xfstests: fix handling of loop partitions | expand

Commit Message

Paolo Pisati April 9, 2020, 11:12 a.m. UTC
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@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(+)

Comments

Po-Hsu Lin May 14, 2020, 9:51 a.m. UTC | #1
Thanks to klebers who dig this patch out.
ACK + Applied and pushed.

Cheers
Sam
diff mbox series

Patch

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