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



commit 4fcd739ceeef2b19194768ce1048177d520179b0
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Thu Oct 10 16:35:46 2019 +0100

    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

 tests/test_SupportedFileSystems.cc | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/tests/test_SupportedFileSystems.cc b/tests/test_SupportedFileSystems.cc
index 39a23812..f8b9959b 100644
--- a/tests/test_SupportedFileSystems.cc
+++ b/tests/test_SupportedFileSystems.cc
@@ -616,7 +616,11 @@ TEST_P(SupportedFileSystemsTest, CreateAndGrow)
 {
        SKIP_IF_FS_DOESNT_SUPPORT(create);
        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_NILFS2);
+       SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS(FS_XFS);
 
        extra_setup(IMAGESIZE_Default);
        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(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_NILFS2);
 
        extra_setup(IMAGESIZE_Larger);
        ASSERT_TRUE(m_fs_object->create(m_partition, m_operation_detail)) << m_operation_detail;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]