Create loop devices for BTRFS read file system interface tests (!49)
For BTRFS the read (and resize) tests fail when using an image file, however the create, write and check tests pass. Selected output from the test program: $ ./test_SupportedFileSystems --gtest_filter='*/btrfs' | fgrep ' ms' [ OK ] My/SupportedFileSystemsTest.Create/btrfs (43 ms) [ FAILED ] My/SupportedFileSystemsTest.CreateAndReadUsage/btrfs, where GetParam() = 7 (95 ms) [ FAILED ] My/SupportedFileSystemsTest.CreateAndReadLabel/btrfs, where GetParam() = 7 (158 ms) [ FAILED ] My/SupportedFileSystemsTest.CreateAndReadUUID/btrfs, where GetParam() = 7 (164 ms) [ OK ] My/SupportedFileSystemsTest.CreateAndWriteLabel/btrfs (164 ms) [ OK ] My/SupportedFileSystemsTest.CreateAndWriteUUID/btrfs (132 ms) [ OK ] My/SupportedFileSystemsTest.CreateAndCheck/btrfs (129 ms) [ OK ] My/SupportedFileSystemsTest.CreateAndRemove/btrfs (0 ms) [ FAILED ] My/SupportedFileSystemsTest.CreateAndGrow/btrfs, where GetParam() = 7 (155 ms) [ FAILED ] My/SupportedFileSystemsTest.CreateAndShrink/btrfs, where GetParam() = 7 (97 ms) [----------] 10 tests from My/SupportedFileSystemsTest (1137 ms total) [==========] 10 tests from 1 test case ran. (1137 ms total) The read operations fail because 'btrfs filesystem show' doesn't work on am image file: $ truncate -s 256M test.img $ mkfs.btrfs test.img btrfs-progs v4.9.1 See http://btrfs.wiki.kernel.org for more information. Label: (null) UUID: de1624ae-39bb-4796-aee4-7ee1fa24c06a Node side: 16384 Sector size: 4096 Filesystem size: 256.00MiB Block group profiles: Data: single Metadata: DUP System: DUP SSD detected: no Incompat features: extref, skinny-metadata Number of devices: 1 Devices: ID SIZE PATH 1 256.00MiB test.img $ btrfs filesystem show test.img ERROR: not a valid btrfs filesystem: /home/centos/programming/c/gparted/tests/test.img $ echo $1 1 Querying a BTRFS image file also fails as root: $ su Password: # btrfs filesystem show test.img ERROR: not a valid btrfs filesystem: /home/centos/programming/c/gparted/tests/test.img # echo $1 1 However querying the BTRFS via a loop device succeeds: # losetup --show --find test.img /dev/loop0 # btrfs filesystem show /dev/loop0 Label: none uuid: de1624ae-39bb-4796-aee4-7ee1fa24c06a Total devices 1 FS bytes used 112.00KiB devid 1 size 256.00MiB used 88.00MiB path /root/test.img There must be some kernel level BTRFS file system device discovery happening because now after creating a loop device for the image file, the BTRFS can be shown via the image file directly: # btrfs filesystem show test.img Label: none uuid: de1624ae-39bb-4796-aee4-7ee1fa24c06a Total devices 1 FS bytes used 112.00KiB devid 1 size 256.00MiB used 88.00MiB path /root/test.img Anyway for the BTRFS reading tests make them required a loop device and therefore root only. Now these tests are skipped as non-root user and pass as root. Addressing BTRFS resizing test failures will be handled in a following commit. Closes !49 - Add file system interface tests
This commit is contained in:
parent
268c34e398
commit
07ad43a107
|
@ -486,6 +486,7 @@ TEST_P(SupportedFileSystemsTest, CreateAndReadUsage)
|
||||||
{
|
{
|
||||||
SKIP_IF_FS_DOESNT_SUPPORT(create);
|
SKIP_IF_FS_DOESNT_SUPPORT(create);
|
||||||
SKIP_IF_FS_DOESNT_SUPPORT(read);
|
SKIP_IF_FS_DOESNT_SUPPORT(read);
|
||||||
|
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);
|
||||||
|
|
||||||
extra_setup();
|
extra_setup();
|
||||||
|
@ -514,6 +515,7 @@ TEST_P(SupportedFileSystemsTest, CreateAndReadLabel)
|
||||||
{
|
{
|
||||||
SKIP_IF_FS_DOESNT_SUPPORT(create);
|
SKIP_IF_FS_DOESNT_SUPPORT(create);
|
||||||
SKIP_IF_FS_DOESNT_SUPPORT(read_label);
|
SKIP_IF_FS_DOESNT_SUPPORT(read_label);
|
||||||
|
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);
|
||||||
|
|
||||||
const char* fs_label = "TEST_LABEL";
|
const char* fs_label = "TEST_LABEL";
|
||||||
|
@ -535,6 +537,7 @@ TEST_P(SupportedFileSystemsTest, CreateAndReadUUID)
|
||||||
{
|
{
|
||||||
SKIP_IF_FS_DOESNT_SUPPORT(create);
|
SKIP_IF_FS_DOESNT_SUPPORT(create);
|
||||||
SKIP_IF_FS_DOESNT_SUPPORT(read_uuid);
|
SKIP_IF_FS_DOESNT_SUPPORT(read_uuid);
|
||||||
|
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);
|
||||||
|
|
||||||
extra_setup();
|
extra_setup();
|
||||||
|
|
Loading…
Reference in New Issue