From: Josef Bacik Date: Tue, 5 Mar 2024 18:52:06 +0000 (+0100) Subject: btrfs/012: adjust how we populate the fs to convert X-Git-Tag: v2024.03.17~28 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=51f280cfa1243e2fc6406d06a411bb138c6f8d29;p=xfstests-dev.git btrfs/012: adjust how we populate the fs to convert /lib/modules/$(uname -r)/ can have symlinks to the source tree where the kernel was built from, which can have all sorts of stuff, which will make the runtime for this test exceedingly long. We're just trying to copy some data into our tree to test with, we don't need the entire devel tree of whatever we're doing. Additionally VM's that aren't built with modules will fail this test. Update the test to use /etc, which will always exist. Additionally use timeout just in case there's large files or some other shenanigans so the test doesn't run forever copying large amounts of files. Reviewed-by: Anand Jain Signed-off-by: Josef Bacik Signed-off-by: Anand Jain [ fix use $TIMEOUT_PROG ] --- diff --git a/tests/btrfs/012 b/tests/btrfs/012 index d9faf81c..ab90c8a7 100755 --- a/tests/btrfs/012 +++ b/tests/btrfs/012 @@ -33,6 +33,8 @@ _require_non_zoned_device "${SCRATCH_DEV}" _require_loop _require_extra_fs ext4 +SOURCE_DIR=/etc +BASENAME=$(basename $SOURCE_DIR) BLOCK_SIZE=`_get_block_size $TEST_DIR` # Create & populate an ext4 filesystem @@ -41,9 +43,9 @@ $MKFS_EXT4_PROG -F -b $BLOCK_SIZE $SCRATCH_DEV > $seqres.full 2>&1 || \ # Manual mount so we don't use -t btrfs or selinux context mount -t ext4 $SCRATCH_DEV $SCRATCH_MNT -_require_fs_space $SCRATCH_MNT $(du -s /lib/modules/`uname -r` | ${AWK_PROG} '{print $1}') +_require_fs_space $SCRATCH_MNT $(du -s $SOURCE_DIR | ${AWK_PROG} '{print $1}') -cp -aR /lib/modules/`uname -r`/ $SCRATCH_MNT +$TIMEOUT_PROG 10 cp -aRP $SOURCE_DIR $SCRATCH_MNT _scratch_unmount # Convert it to btrfs, mount it, verify the data @@ -51,7 +53,7 @@ $BTRFS_CONVERT_PROG $SCRATCH_DEV >> $seqres.full 2>&1 || \ _fail "btrfs-convert failed" _try_scratch_mount || _fail "Could not mount new btrfs fs" # (Ignore the symlinks which may be broken/nonexistent) -diff -r /lib/modules/`uname -r`/ $SCRATCH_MNT/`uname -r`/ 2>&1 | grep -vw "source\|build" +diff --no-dereference -r $SOURCE_DIR $SCRATCH_MNT/$BASENAME/ 2>&1 # Old ext4 image file should exist & be consistent $E2FSCK_PROG -fn $SCRATCH_MNT/ext2_saved/image >> $seqres.full 2>&1 || \ @@ -62,12 +64,12 @@ mkdir -p $SCRATCH_MNT/mnt mount -o loop $SCRATCH_MNT/ext2_saved/image $SCRATCH_MNT/mnt || \ _fail "could not loop mount saved ext4 image" # Ignore the symlinks which may be broken/nonexistent -diff -r /lib/modules/`uname -r`/ $SCRATCH_MNT/mnt/`uname -r`/ 2>&1 | grep -vw "source\|build" +diff --no-dereference -r $SOURCE_DIR $SCRATCH_MNT/mnt/$BASENAME/ 2>&1 umount $SCRATCH_MNT/mnt # Now put some fresh data on the btrfs fs mkdir -p $SCRATCH_MNT/new -cp -aR /lib/modules/`uname -r`/ $SCRATCH_MNT/new +$TIMEOUT_PROG 10 cp -aRP $SOURCE_DIR $SCRATCH_MNT/new _scratch_unmount @@ -82,7 +84,7 @@ $E2FSCK_PROG -fn $SCRATCH_DEV >> $seqres.full 2>&1 || \ # Mount the un-converted ext4 device & check the contents mount -t ext4 $SCRATCH_DEV $SCRATCH_MNT # (Ignore the symlinks which may be broken/nonexistent) -diff -r /lib/modules/`uname -r`/ $SCRATCH_MNT/`uname -r`/ 2>&1 | grep -vw "source\|build" +diff --no-dereference -r $SOURCE_DIR $SCRATCH_MNT/$BASENAME/ 2>&1 _scratch_unmount