Page MenuHomeFreeBSD

du_test: Skip three tests if sparse files are not supported
ClosedPublic

Authored by arichardson on Jan 28 2021, 10:11 AM.

Details

Summary

This fixes running the du tests with /tmp as tmpfs (which is what we do in the
CheriBSD CI).

Obtained from: CheriBSD
Co-authored-by: Brooks Davis <brooks@FreeBSD.org>

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ngie requested changes to this revision.Jan 28 2021, 11:10 PM

This isn't the right approach; please use getconf MIN_HOLE_SIZE instead, like the ls tests do

83 create_test_inputs2()
84 {
85         create_test_dir
86 
87         if ! getconf MIN_HOLE_SIZE "$(pwd)"; then
88             echo "getconf MIN_HOLE_SIZE $(pwd) failed; sparse files probably" \
89                  "not supported by file system"
90             mount
91             atf_skip "Test's work directory does not support sparse files;" \
92                      "try with a different TMPDIR?"
93         fi
This revision now requires changes to proceed.Jan 28 2021, 11:10 PM
In D28398#635444, @ngie wrote:

This isn't the right approach; please use getconf MIN_HOLE_SIZE instead, like the ls tests do

83 create_test_inputs2()
84 {
85         create_test_dir
86 
87         if ! getconf MIN_HOLE_SIZE "$(pwd)"; then
88             echo "getconf MIN_HOLE_SIZE $(pwd) failed; sparse files probably" \
89                  "not supported by file system"
90             mount
91             atf_skip "Test's work directory does not support sparse files;" \
92                      "try with a different TMPDIR?"
93         fi

Thanks, I was not aware of MIN_HOLE_SIZE. Seems to report a sensible value on UFS and fail on tmpfs and smbfs. Will update the patch tomorrow.

With this change I now get three skipped tests by default, and if I do env TMPDIR=/root/tmp to run them on UFS all of them pass.

This might be a good thing to add to a general purpose library.

This revision is now accepted and ready to land.Wed, Feb 3, 3:47 PM