[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: improve diagnostics when asserting empty files
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] tests: improve diagnostics when asserting empty files |
Date: |
Tue, 06 May 2014 11:53:30 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 05/06/2014 07:43 AM, Bernhard Voelker wrote:
> On 05/06/2014 03:46 AM, Pádraig Brady wrote:
>> * tests/chmod/c-option.sh: Use `compare /dev/null ... || fail=1`
>> rather than `test -s ... && fail=1`, so that the file contents
>> are output, thus improving diagnostics for failing tests.
>> * tests/cp/cp-a-selinux.sh: Likewise.
>> * tests/cp/cp-mv-enotsup-xattr.sh: Likewise.
>> * tests/dd/misc.sh: Likewise.
>> * tests/misc/nice.sh: Likewise.
>> * tests/misc/xattr.sh: Likewise.
>> * tests/mv/update.sh: Likewise.
>> * tests/rm/deep-2.sh: Likewise.
>> * tests/rm/read-only.sh: Likewise.
>> * tests/split/r-chunk.sh: Likewise.
>> * tests/tail-2/follow-stdin.sh: Likewise.
>> * tests/tail-2/wait.sh: Likewise.
>> * tests/touch/no-dereference.sh: Likewise.
>
> Great idea!
>
> I'm curious: what was the criteria to choose those tests?
> I mean, "cd tests && git grep 'test -s.*&&' | wc -l" still
> counts 21 matches, even one where the part after the '&&'
> could be simplified like in tail-2/inotify-race.sh:55:
>
> test -s gdb.out && { cat gdb.out; skip_ "can't set breakpoints in tail"; }
> vs.
> compare /dev/null gdb.out || skip_ "can't set breakpoints in tail"
Yes it would be better to convert the above also.
For most of the other ones, outputting the contents on failure
wouldn't impart more info, but consistency beats edge case noise here,
so I've converted them all and added a syntax-check to avoid
future occurrences. New version is attached.
thanks for the thorough review!
Pádraig.
test-compare-null.patch
Description: Text Data