From 893934258d701cf3bc9dd917098895b48a14d0cc Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Tue, 27 Aug 2019 16:54:50 +0200 Subject: [PATCH] btrfs-progs: tests: mkfs and extra large devices Test case for mkfs to handle if total device size overflows 16EiB. The device images are created inside temporary btrfs so this works on any underlying filesystem (unlike NFS or tmpfs). Signed-off-by: Jeff Mahoney [ split test from original patch and update to work on any filesystem ] Signed-off-by: David Sterba --- .../018-multidevice-overflow/test.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 tests/mkfs-tests/018-multidevice-overflow/test.sh diff --git a/tests/mkfs-tests/018-multidevice-overflow/test.sh b/tests/mkfs-tests/018-multidevice-overflow/test.sh new file mode 100755 index 00000000..6c2f4dba --- /dev/null +++ b/tests/mkfs-tests/018-multidevice-overflow/test.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# test if mkfs.btrfs will create file systems that overflow total_bytes + +source "$TEST_TOP/common" + +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper +prepare_test_dev + +# create a temporary btrfs filesystem for the images to make sure the +# exabyte-scale files will be reliably created +run_check_mkfs_test_dev +run_check_mount_test_dev + +run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1" +run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img2" +run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img3" + +run_mustfail "mkfs for too-large images" \ + $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_MNT"/img[123] + +run_check_umount_test_dev