tests: add test for e2fsck of verity file
PATCH 1/1 tests: add test for e2fsck of verity file
From: Eric Biggers <[email protected]>
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 <[email protected]>
--- 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
tests/f_verity/expect.1 new file +7 -0
@@ -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
tests/f_verity/image.gz new file binary +0 -0
tests/f_verity/mkimage.sh new file +28 -0
@@ -0,0 +1,28 @@ +#!/bin/bash + +# This is the script that was used to create the image.gz in this directory. + +set -e -u + +mkdir -p mnt +umount mnt &> /dev/null || true + +dd if=/dev/zero of=image bs=4096 count=128 +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
tests/f_verity/name new file +1 -0
@@ -0,0 +1 @@ +verity file
tests/f_verity/script new file +2 -0
@@ -0,0 +1,2 @@ +ONE_PASS_ONLY="true" +. $cmd_dir/run_e2fsck
Signature · 1 line
2.22.0.rc1.257.g3120a18244-goog
Theodore Ts'o
AppliedQuoted 10 lines · Eric Biggers
From: Eric Biggers <[email protected]>
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 pasti_size") and43466d039689("e2fsck: handle verity files inscan_extent_node()").Signed-off-by Eric Biggers <[email protected]>
Thanks, applied.
- Ted