On Sat, Jun 16, 2018 at 10:13:34AM +0300, Artem Blagodarenko wrote: > From: Andreas Dilger <andreas.dilger@xxxxxxxxx> > > Verify correct operation in the case of writing files with allocated > blocks at the end of the file beyond i_size. This can happen for > PAGE_SIZE > blocksize, or through fallocate(). > > The f_eofblocks thest checks quite the same situation, but for broken > file system. This test is about correct file. > > Signed-off-by: Andreas Dilger <andreas.dilger@xxxxxxxxx> > Signed-off-by: Artem Blagodarenko <artem.blagodarenko@xxxxxxxxx> I had to apply the following fixup so that the test it would (a) pass, and (b) it would correctly test the orignial goal of the test. Problems: * $RANDOM is not set in upstream test framework. This meant DATA_FILE was set to the NULL string, but since stdout of debugfs was redirected to /dev/null, apparently no one noticed. * Using the source of /dev/zero for the file doesn't work since debugfs's write command now will write a sparse file. But that means you're not testing what you had hoped to be testing. When this test was originally written the sparse file optimization was probably not present, but then when the test was forward ported to a newer version of e2fsprogs, the test started failing due to the e2fsck summary line being different, and someone probably just blindly fixed up the golden output file instead of asking the question why it was the expected output had changed. - Ted diff --git a/tests/f_pgsize_gt_blksize/expect.1 b/tests/f_pgsize_gt_blksize/expect.1 index 628a376a2..c00f5db51 100644 --- a/tests/f_pgsize_gt_blksize/expect.1 +++ b/tests/f_pgsize_gt_blksize/expect.1 @@ -3,5 +3,5 @@ Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information -test_filesys: 12/32 files (0.0% non-contiguous), 23/100 blocks +test_filesys: 12/32 files (0.0% non-contiguous), 40/100 blocks Exit status is 0 diff --git a/tests/f_pgsize_gt_blksize/expect.2 b/tests/f_pgsize_gt_blksize/expect.2 index 628a376a2..c00f5db51 100644 --- a/tests/f_pgsize_gt_blksize/expect.2 +++ b/tests/f_pgsize_gt_blksize/expect.2 @@ -3,5 +3,5 @@ Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information -test_filesys: 12/32 files (0.0% non-contiguous), 23/100 blocks +test_filesys: 12/32 files (0.0% non-contiguous), 40/100 blocks Exit status is 0 diff --git a/tests/f_pgsize_gt_blksize/script b/tests/f_pgsize_gt_blksize/script index 54fa9b81e..422b83ae4 100644 --- a/tests/f_pgsize_gt_blksize/script +++ b/tests/f_pgsize_gt_blksize/script @@ -3,8 +3,8 @@ SKIP_GUNZIP="true" touch $TMPFILE $MKE2FS -N 32 -F -o Linux -b 1024 $TMPFILE 100 > /dev/null 2>&1 -DATA_FILE=$RANDOM -dd if=/dev/zero of=$DATA_FILE bs=1k count=16 > /dev/null 2>&1 +DATA_FILE=$(mktemp ${TMPDIR:-/tmp}/e2fsprogs-zerodata.XXXXXX) +dd if=$TEST_BITS of=$DATA_FILE bs=1k count=16 > /dev/null 2>&1 $DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1 write $DATA_FILE foo set_inode_field foo size 13000