Create loop devices for online resized file system tests (!49)

File systems BTRFS, JFS, NILFS2 and XFS can only be resized while
mounted, but only root can mount file systems.  Therefore these tests
fail.  Also BTRFS resize uses 'btrfs filesystem show' to discover the
devid, which also fails as described in the previous commit message.

Note that root can mount a file system image directly, but that it
implicitly creates loop device:
    # truncate -s 256M test.img
    # mkfs.xfs test.img
    # mount test.img /mnt/1

    # fgrep /mnt/1 /proc/mounts
    /dev/loop0 /mnt/1 xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0
    # losetup -a
    /dev/loop0: [64768]:35826659 (/root/test.img)

Therefore make these tests root only and require an explicit loop
device.  Now these file system resize tests succeed as root and are
skipped as non-root.

Closes !49 - Add file system interface tests
This commit is contained in:
Mike Fleetwood 2019-10-10 16:35:46 +01:00 committed by Curtis Gedak
parent 07ad43a107
commit 4fcd739cee
1 changed files with 6 additions and 0 deletions

View File

@ -616,7 +616,11 @@ TEST_P(SupportedFileSystemsTest, CreateAndGrow)
{ {
SKIP_IF_FS_DOESNT_SUPPORT(create); SKIP_IF_FS_DOESNT_SUPPORT(create);
SKIP_IF_FS_DOESNT_SUPPORT(grow); SKIP_IF_FS_DOESNT_SUPPORT(grow);
SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_BTRFS);
SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_JFS);
SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_LVM2_PV); SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_LVM2_PV);
SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_NILFS2);
SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_XFS);
extra_setup(IMAGESIZE_Default); extra_setup(IMAGESIZE_Default);
ASSERT_TRUE(m_fs_object->create(m_partition, m_operation_detail)) << m_operation_detail; ASSERT_TRUE(m_fs_object->create(m_partition, m_operation_detail)) << m_operation_detail;
@ -632,7 +636,9 @@ TEST_P(SupportedFileSystemsTest, CreateAndShrink)
{ {
SKIP_IF_FS_DOESNT_SUPPORT(create); SKIP_IF_FS_DOESNT_SUPPORT(create);
SKIP_IF_FS_DOESNT_SUPPORT(shrink); SKIP_IF_FS_DOESNT_SUPPORT(shrink);
SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_BTRFS);
SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_LVM2_PV); SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_LVM2_PV);
SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_NILFS2);
extra_setup(IMAGESIZE_Larger); extra_setup(IMAGESIZE_Larger);
ASSERT_TRUE(m_fs_object->create(m_partition, m_operation_detail)) << m_operation_detail; ASSERT_TRUE(m_fs_object->create(m_partition, m_operation_detail)) << m_operation_detail;