On Tue, May 01, 2018 at 10:25:57PM -0600, Andreas Dilger wrote: > If the TEST_BITS file is sparse, then the "debugfs -R write" > command may skip holes in the file when copying it into the > test image (depending on whether SEEK_HOLE/SEEK_DATA and/or > FIEMAP are available in the copy_file() function). > > This was causing test failures on MacOS in the f_dup_resize > and d_loaddump tests because the TEST_BITS file was the > compiled "debugfs" binary, which apparently has holes when > built on MacOS, and the number of blocks allocated in the > test image was reduced as a result. This caused the expect > output to differ in the summary line and resulted in failure. > > Instead of using the debugfs binary for TEST_BITS, generate > a temporary file using /dev/urandom, if available. If not, > fall back to the old behaviour or using debugfs. > > Signed-off-by: Andreas Dilger <adilger@xxxxxxxxx> Applied with the following fix up. - Ted diff --git a/.gitignore b/.gitignore index ac5c2c1d9..df4021c90 100644 --- a/.gitignore +++ b/.gitignore @@ -223,6 +223,7 @@ tests/*.failed tests/*.log tests/*.tmp tests/*.slow +tests/test_data.tmp tests/mke2fs.conf tests/test_script tests/test_one diff --git a/tests/Makefile.in b/tests/Makefile.in index 7b9df62a8..4a1975894 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -94,7 +94,7 @@ testend: test_one ${TDIR}/image clean:: $(RM) -f *~ *.log *.new *.failed *.ok *.tmp *.slow - $(RM) -f test_one test_script mke2fs.conf + $(RM) -f test_one test_script mke2fs.conf test_data.tmp distclean:: clean $(RM) -f Makefile diff --git a/tests/test_config b/tests/test_config index cf9c79c6b..595567fc5 100644 --- a/tests/test_config +++ b/tests/test_config @@ -18,7 +18,7 @@ if [ ! -s $TEST_BITS ]; then # create a non-sparse test file if possible, since debugfs may be # sparse and cause "debugfs write" (using copy_file()) to skip holes # during testing if SEEK_DATA/SEEK_HOLE or FS_IOC_FIEMAP are available - dd if=/dev/urandom of=$TEST_BITS bs=128k count=1 > /dev/null 2&>1 || + dd if=/dev/urandom of=$TEST_BITS bs=128k count=1 > /dev/null 2>&1 || TEST_BITS="$DEFBUGFS_EXE" fi RESIZE2FS_EXE="../resize/resize2fs"