git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t2027: avoid using pipes

From
Prathamesh Chavan <pc44800@gmail.com>
Date
Mar 8, 2017, 21:38 UTC
Message-ID
<CAME+mvWVDPT+-F7Z-O=XR_EN4qeNEoQ5ksLpLVkVBb0O9LKROg@mail.gmail.com>
In-Reply-To
<E1cldl4-0006L6-CU@mylo.jdl.com>

Whenever a test suite is executed, after finishing every test, after running all tests, the function test_done is called. You may find this function in test-lib.sh . This function displays the result of the test and also removes the trash created by running the test.

On Wed, Mar 8, 2017 at 9:14 PM, Jon Loeliger <jdl@jdl.com> wrote:
Show 31 quoted lines
> So, like, Prathamesh Chavan said:
>> The exit code of the upstream of a pipe is ignored thus we should avoid
>> using it. By writing out the output of the git command to a file, we
>> can test the exit codes of both the commands.
>>
>> Signed-off-by: Prathamesh <pc44800@gmail.com>
>> ---
>>  t/t2027-worktree-list.sh | 14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh
>> index 848da5f..daa7a04 100755
>> --- a/t/t2027-worktree-list.sh
>> +++ b/t/t2027-worktree-list.sh
>> @@ -31,7 +31,7 @@ test_expect_success '"list" all worktrees from main' '
>>       test_when_finished "rm -rf here && git worktree prune" &&
>>       git worktree add --detach here master &&
>>       echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short
>> HEAD) (detached HEAD)" >>expect &&
>> -     git worktree list | sed "s/  */ /g" >actual &&
>> +     git worktree list >out && sed "s/  */ /g" <out >actual &&
>>       test_cmp expect actual
>>  '
>
> I confess I am not familiar with the test set up.
> However, I'd ask the question do we care about the
> lingering "out" and "actual" files here?  Or will
> they silently be cleaned up along the way later?
>
> Thanks,
> jdl
Previous: Jon LoeligerNext: Prathamesh Chavan
Message 3 of 11 in “t2027: avoid using pipes”
  1. t2027: avoid using pipesPrathamesh Chavan, Mar 8, 2017
  2. Jon LoeligerMar 8, 2017
  3. Prathamesh ChavanMar 8, 2017
  4. Prathamesh ChavanMar 8, 2017
  5. Christian CouderMar 9, 2017
  6. Prathamesh ChavanMar 9, 2017
  7. t2027: avoid using pipesPrathamesh Chavan, Mar 9, 2017
  8. t2027: avoid using pipesPrathamesh Chavan, Mar 9, 2017
  9. Christian CouderMar 9, 2017
  10. t2027: avoid using pipesPrathamesh Chavan, Mar 9, 2017
  11. Prathamesh ChavanMar 10, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.