btrfs-progs/tests/convert-tests/017-fs-near-full/test.sh
Qu Wenruo 761add2622 btrfs-progs: tests: check that convert does not create extents beyond device boundary
Add a test case to check if the converted fs has device extent beyond
boundary.

The disk layout of source ext4 fs needs some extents to make them
allocated at the very end of the fs.  The script is from the original
reporter.

Also, since the existing convert tests always uses 512M as device size,
which is not suitable for this test case, make it to grab the existing
device size to co-operate with this test case.

Reported-by: Jiachen YANG <farseerfc@gmail.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-06-29 17:45:39 +02:00

32 lines
833 B
Bash
Executable File

#!/bin/bash
# Check if btrfs-convert creates filesystem with device extents beyond the
# device boundary
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev 1G
check_prereq btrfs-convert
check_global_prereq mke2fs
check_global_prereq fallocate
convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096
# Use up 800MiB first
for i in $(seq 1 4); do
run_check $SUDO_HELPER fallocate -l 200M "$TEST_MNT/file$i"
done
# Then add 5MiB for above files. These 5 MiB will be allocated near the very
# end of the fs, to confuse btrfs-convert
for i in $(seq 1 4); do
run_check $SUDO_HELPER fallocate -l 205M "$TEST_MNT/file$i"
done
run_check_umount_test_dev
# convert_test_do_convert() will call btrfs check, which should expose any
# invalid inline extent with too large size
convert_test_do_convert