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

Re: [PATCH 2/2] t9700: ensure cat-file info isn't buffered by default

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Jun 19, 2024, 09:08 UTC
Message-ID
<6e80eea5-b6ce-4218-8c43-dde2b5a698f5@gmail.com>
In-Reply-To
<20240617104326.3522535-3-e@80x24.org>
Hi Eric
On 17/06/2024 11:43, Eric Wong wrote:
> +# ensure --batch-check is unbuffered by default
> +my ($pid, $in, $out, $ctx) = $r->command_bidi_pipe(qw(cat-file --batch-check));
> +print $out $file1hash, "\n" or die $!;

It's been a while since I did any perl scripting and I'm not clear whether $out is buffered or not and if it is whether it is guaranteed to be flushed when we print "\n". It might be worth adding a explicit flush so it is clear that any deadlocks come from cat-file and not our test code.

> +my $info = <$in>;

Is there an easy way to add a timeout to this read so that the failure mode isn't "the test hangs without printing anything"? I'm not sure that failure mode is easy to diagnose from our CI output as it is hard to tell which test caused the CI to timeout and it takes ages for the CI to time out.

Best Wishes
Phillip
Show 14 quoted lines
> +is $info, "$file1hash blob 15\n", 'command_bidi_pipe w/ --batch-check';
> +$r->command_close_bidi_pipe($pid, $in, $out, $ctx);
> +
> +# ditto with `info' with --batch-command
> +($pid, $in, $out, $ctx) = $r->command_bidi_pipe(qw(cat-file --batch-command));
> +print $out 'info ', $file1hash, "\n" or die $!;
> +$info = <$in>;
> +is $info, "$file1hash blob 15\n", 'command_bidi_pipe w/ --batch-command=info';
> +$r->command_close_bidi_pipe($pid, $in, $out, $ctx);
> +
>   printf "1..%d\n", Test::More->builder->current_test;
>   
>   my $is_passing = eval { Test::More->is_passing };
> 
Previous: Junio C HamanoNext: Eric Wong
Message 14 of 16 in “cat-file related doc and test”
  1. 0/2 cat-file related doc and testEric Wong, Jun 17, 2024
  2. 1/2 Git.pm: use array in command_bidi_pipe exampleEric Wong, Jun 17, 2024
  3. Junio C HamanoJun 17, 2024
  4. 2/2 t9700: ensure cat-file info isn't buffered by defaultEric Wong, Jun 17, 2024
  5. Junio C HamanoJun 17, 2024
  6. 2/2 t1006: ensure cat-file info isn't buffered by defaultEric Wong, Jun 18, 2024
  7. Junio C HamanoJun 18, 2024
  8. Eric WongJun 19, 2024
  9. Junio C HamanoJun 20, 2024
  10. Jeff KingJun 21, 2024
  11. Eric WongJun 21, 2024
  12. Jeff KingJun 24, 2024
  13. Junio C HamanoJun 17, 2024
  14. Phillip WoodJun 19, 2024
  15. Eric WongJun 19, 2024
  16. Phillip WoodJun 21, 2024

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.