Pádraig Brady wrote:
> On 08/08/2012 05:07 PM, Jim Meyering wrote:
>> Bernhard Voelker wrote:
>>
>>> On 08/08/2012 05:43 PM, Pádraig Brady wrote:
>>>
>>>> +require_mount_list_()
>>>> +{
>>>> + df >/dev/null 2>&1 ||
>>>> + skip_ "Unable to read the list of mounted file systems."
>>>> +}
>>>> +
>>>
>>> Hmm, I think this is not enough: df can also fail due to other reasons,
>>> e.g. when a mount point is not reachable by the user:
>>>
>>> $ src/df > /dev/null ; echo $?
>>> src/df: ‘/root/backup’: Permission denied
>>> 1
>>
>> Good point.
>>
>> "df ." or "df /" should be more reliable.
>
> But then it won't fail. It's tricky :)
Yep. I should have looked at the code.
> Updated version that explicitly matches the error is attached.
...
> Subject: [PATCH] tests: fix validation of local file systems
>
> * tests/init.cfg (require_mount_list_): A new function
> to ensure we can read the list of file systems.
> (require_local_dir_): Call the above function as otherwise
s/ as/, as/ :-)
> the check is invalid.
> * tests/df/total-unprocessed: Ensure df can read the
> list of mounted file systems so that --local can be honored.
...
> +require_mount_list_()
> +{
> + mount_list_fail='cannot read table of mounted file systems'
Might as well get in the habit of using "local" in this file.
> + df 2>&1 | grep -F "$mount_list_fail" >/dev/null &&
> + skip_ "$mount_list_fail"
> +}
> +
> require_local_dir_()
> {
> + require_mount_list_
> is_local_dir_ . ||
> skip_ "This test must be run on a local file system."
> }
ACK.