Whamcloud - gitweb
tests: don't use a sparse test file
authorAndreas Dilger <adilger@dilger.ca>
Fri, 22 Jun 2018 15:42:14 +0000 (11:42 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 22 Jun 2018 15:42:14 +0000 (11:42 -0400)
commit5cf8bb11001aebeed4af23e463ab77744af95058
tree2576d45bd0862feb978fe16a148e4f6029e4a5d4
parent8b5273d5d10d180d981381353d2c88fee5744a2d
tests: don't use a sparse test file

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.

[ Fixed up use of non-POSIX /bin/sh constructs and add test_data.tmp to
  .gitignore and files to be deleted on a make clean. --tytso ]

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
.gitignore
tests/Makefile.in
tests/test_config