Re: [PATCH v2] t9116: avoid using pipes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/03/20 12:04 am, Christian Couder wrote:
> On Tue, Mar 24, 2020 at 10:36 AM Shanthanu <shanthanu.s.rai9@xxxxxxxxx> wrote:
>> Commit c6f44e1da5 (t9813: avoid using pipes, 2017-01-04) recommends to
>> avoid using pipes, since the exit code of upstream in the pipe is
>> ignored. Hence, redirect the output to a file and parse that file.
>>
>> Commit de26f02db1 (t9001, t9116: avoid pipes, 2020-02-14) noted that
>> this also allows easy debugging in case the test fails, since the file
>> will be left on disk and can be manually inspected.
>>
>> Signed-off-by: Shanthanu <shanthanu.s.rai9@xxxxxxxxx>
> We usually ask for a legal name in a format similar to "<Firstname>
> <MaybeMiddleNameInitial> <Lastname>" where <MaybeMiddleNameInitial>
> can be omitted. The name should also match what is in the "From:"
> field of the emails you send.
Okay, I will keep that in mind.
>> ---
>>  t/t9116-git-svn-log.sh | 53 +++++++++++++++++++++++++++++++-----------
>>  1 file changed, 39 insertions(+), 14 deletions(-)
>>
>> diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
>> index 0a9f1ef366..56d68e4aed 100755
>> --- a/t/t9116-git-svn-log.sh
>> +++ b/t/t9116-git-svn-log.sh
>> @@ -61,12 +61,16 @@ printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
>>
>>  test_expect_success 'test ascending revision range' "
>>         git reset --hard origin/trunk &&
>> -       git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 -
>> +       git svn log -r 1:4 >out &&
>> +       grep '^r[0-9]' out | cut -d'|' -f1 >actual &&
>> +       test_cmp expected-range-r1-r2-r4 actual
>>         "
> It seems that the code that your patch changes is repeated a lot in
> this test script. I wonder if it would be better to write a shell
> function to avoid those repetitions.

Oh yeah, that would be better. I will add a function. Just clarifying,
the function should run the git, grep, cut and test_cmp commands?

Also, could you suggest an appropriate name for this function?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux