Subject: Re: [PATCH 2/2] Don't rely on strerror text when testing rmdir failure

From: Junio C Hamano <[email-masked]>
Date: Mon, 31 Mar 2014 10:35:48 -0700

Jens Lehmann <[email-masked]> writes:

> Am 29.03.2014 16:39, schrieb Charles Bailey:
>> AIX doesn't make a distiction between EEXIST and ENOTEMPTY so relying on
>> the strerror string for the rmdir failure is fragile. Just test that the
>> start of the string matches the Git controlled "failed to rmdir..."
>> error. The exact text of the OS generated error string isn't important
>> to the test.
>
> Makes sense.
>
>> Signed-off-by: Charles Bailey <[email-masked]>
>> ---
>>  t/t3600-rm.sh | 5 ++---
>>  t/t7001-mv.sh | 3 +--
>>  2 files changed, 3 insertions(+), 5 deletions(-)
>> 
>> diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
>> index 3d30581..23eed17 100755
>> --- a/t/t3600-rm.sh
>> +++ b/t/t3600-rm.sh
>> @@ -709,10 +709,9 @@ test_expect_success 'checking out a commit after submodule removal needs manual
>>  	git commit -m "submodule removal" submod &&
>>  	git checkout HEAD^ &&
>>  	git submodule update &&
>> -	git checkout -q HEAD^ 2>actual &&
>> +	git checkout -q HEAD^ 2>/dev/null &&
>
> Isn't this unrelated to the strerror issue you are fixing here?
> Why not just drop the redirection completely? But maybe I'm just
> being to pedantic here ;-)

No, that sounds like a very reasonable suggestion.  Especially given
that the redirection destination is overwritten immediately after.

In general tests should not have to squelch their standard error
output with 2>/dev/null; that is a job for the test harness, and
they will be shown in the output of "./t3600-rm -v" to serve as
anchor point while finding where a test goes wrong, which is a good
thing.