Pádraig Brady wrote:
>> ...
>>> +# TODO: we might relax this requirement in some tests, if
>>> +# for example, truncate --alloc (posix_fallocate) is implemented.
>>> +require_dev_zero_()
>>> +{
>>> + test -c /dev/zero ||
>>> + skip_ "This test requires /dev/zero support."
>>> +}
>>
>> This TODO seems like good justification for adding the truncate option.
>>
>> However, just to be a little paranoid, it might be better
>> to ensure that we can actually read from it, too.
>>
>> What do you think about a syntax-check that requires a use of
>> require_dev_zero_ in each file under tests/ that uses /dev/zero?
>
> I've updated the patch to do both of the above suggestions.
> However it probably shouldn't be applied unless we're
> targetting systems without /dev/zero.
Thanks for updating it.
> Subject: [PATCH] tests: don't assume the existence of /dev/zero
>
> /dev/zero is not defined by POSIX and is
> not available on NetBSD at least.
Given the number of matches and uses here,
http://google.com/search?q=/dev/zero+site:netbsd.org
I think the above comment must be inaccurate.
However, I like the patch and think it's worth using,
if only for when people test on those rare systems
lacking a useful /dev/zero.
Please push it after 8.14.
> * tests/init.cfg (require_dev_zero_): Add this new function.
> * tests/cp/cp-a-selinux: Use require_dev_zero_.
> * tests/cp/cp-mv-enotsup-xattr: Likewise.
> * tests/cp/fiemap-2: Likewise.
> * tests/dd/nocache: Likewise.
> * tests/mkdir/writable-under-readonly: Likewise.
> * tests/rm/read-only: Likewise.
> * tests/split/l-chunk: Likewise.
> * tests/cp/sparse-fiemap: Likewise. Also use
> the more standard require_perl_.
> * cfg.mk (sc_require_dev_zero): A new syntax check
> to ensure require_dev_zero_ is used in tests
> mentioning /dev/zero.