aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2024-03-05 19:52:06 +0100
committerZorro Lang <zlang@kernel.org>2024-03-11 12:50:09 +0800
commit51f280cfa1243e2fc6406d06a411bb138c6f8d29 (patch)
treebc71005733f2641cc54ce28c4f4758c0d29938f9
parent18ecbf559bc5bf60329ec5aeb415c77a88ba6215 (diff)
downloadxfstests-dev-51f280cfa1243e2fc6406d06a411bb138c6f8d29.tar.gz
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 <anand.jain@oracle.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Anand Jain <anand.jain@oracle.com> [ fix use $TIMEOUT_PROG ]
-rwxr-xr-xtests/btrfs/01214
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/btrfs/012 b/tests/btrfs/012
index d9faf81ce1..ab90c8a720 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