From 0e660ee14592d2e893522f2ccc836c011ca4f383 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 28 May 2019 16:12:30 -0700 Subject: [PATCH] tests: add test for e2fsck of verity file Test that e2fsck doesn't report errors when an inode with the 'verity' flag has blocks past i_size. This is a regression test for commits 3baafde6a8ae ("e2fsck: allow verity files to have initialized blocks past i_size") and 43466d039689 ("e2fsck: handle verity files in scan_extent_node()"). Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o --- tests/f_verity/expect.1 | 7 +++++++ tests/f_verity/image.gz | Bin 0 -> 2247 bytes tests/f_verity/mkimage.sh | 28 ++++++++++++++++++++++++++++ tests/f_verity/name | 1 + tests/f_verity/script | 2 ++ 5 files changed, 38 insertions(+) create mode 100644 tests/f_verity/expect.1 create mode 100644 tests/f_verity/image.gz create mode 100755 tests/f_verity/mkimage.sh create mode 100644 tests/f_verity/name create mode 100644 tests/f_verity/script diff --git a/tests/f_verity/expect.1 b/tests/f_verity/expect.1 new file mode 100644 index 0000000..0705967 --- /dev/null +++ b/tests/f_verity/expect.1 @@ -0,0 +1,7 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test_filesys: 12/128 files (8.3% non-contiguous), 58/128 blocks +Exit status is 0 diff --git a/tests/f_verity/image.gz b/tests/f_verity/image.gz new file mode 100644 index 0000000000000000000000000000000000000000..72dfd8169ace0e2a2ace35f5d2c010601623b168 GIT binary patch literal 2247 zcmd6neNYp38pl()19U9$#yh>15_Hh=E(%hjAeqsQ6)*+N@KPj%+!;6#4X@IWz*;L( zUuYD@^AmTneHFEpWWYg zp6B!Yc4s|rxw`J{TT0#Hbp9ealY&~((C<`JJY3%8@5vaH(4AApr+di_5qP?Vv4zN z^eveGWpa-%jtCzuTMt#Qmpz^7p6Q&WcbxVa-}mlC0G!pMid;FYCoMa%N%+rILB%}^ zth!6jZsyP-U;hFL8`#F7LH}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 +mke2fs -O 'verity,extents' -b 4096 -N 128 image +mount image mnt + +# Create a verity file, but make it fragmented so that it needs at least one +# extent tree index node, in order to cover the scan_extent_node() case. +for i in {1..80}; do + head -c 4096 /dev/zero > mnt/tmp_$i +done +for i in {1..80..2}; do + rm mnt/tmp_$i +done +head -c $((40 * 4096)) /dev/zero > mnt/file +fsverity enable mnt/file +rm mnt/tmp_* + +umount mnt +rmdir mnt +gzip -9 -f image diff --git a/tests/f_verity/name b/tests/f_verity/name new file mode 100644 index 0000000..f43910f --- /dev/null +++ b/tests/f_verity/name @@ -0,0 +1 @@ +verity file diff --git a/tests/f_verity/script b/tests/f_verity/script new file mode 100644 index 0000000..8ab2b9c --- /dev/null +++ b/tests/f_verity/script @@ -0,0 +1,2 @@ +ONE_PASS_ONLY="true" +. $cmd_dir/run_e2fsck -- 1.8.3.1