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

Re: [PATCH 1/3] test-terminal: give the child an empty stdin TTY

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 12, 2011, 20:38 UTC
Message-ID
<7v7h2134qn.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20111212191602.GA14061@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Is this right place to do it?
>
> It doesn't catch "cd t && make"....

That's just an illustration. I know my audiences who will give us real tested patches are intelligent ;-).

And I tend to agree that at the test-lib.sh level might be a bit too low for convenience of debugging, but it is probably a good start. An obvious alternative would be a patch similar to the illustration patch applied to t/Makefile.

As I said in a separate post, I think this is orthogonal to the test-terminal patch under discussion. Being able to give the tested programs an environment that mimics an interactive tty session better is a good thing to do regardless of the "test should not read from make's stdin" issue.

Show 27 quoted lines
> happen in t/Makefile. But I actually wonder if it should be in
> test-lib.sh, as it is as much about cleaning up the test script's
> environment as it is about protecting people running "make test" in a
> loop. I.e., something like:
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index bdd9513..5a38505 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -198,6 +198,9 @@ else
>  	exec 4>/dev/null 3>/dev/null
>  fi
>  
> +exec 6<&0
> +exec 0</dev/null
> +
>  test_failure=0
>  test_count=0
>  test_fixed=0
>
> One downside of that approach is that it makes it harder to insert
> questionable debugging statements into test scripts. E.g., sometimes I
> will temporarily throw a "gdb" or even a "bash" invocation into a test
> script to investigate a failure. But that would still be possible by
> redirecting from "<6".
>
> -Peff
Previous: Jeff KingNext: Jonathan Nieder
Message 15 of 16 in “test-terminal: give the child an empty stdin TTY”
  1. 1/3 test-terminal: give the child an empty stdin TTYThomas Rast, Dec 12, 2011
  2. 2/3 test-terminal: set output terminals to raw modeThomas Rast, Dec 12, 2011
  3. Jonathan NiederDec 12, 2011
  4. Thomas RastDec 12, 2011
  5. Jonathan NiederDec 13, 2011
  6. 3/3 t/lib-terminal: test test-terminal's sanityThomas Rast, Dec 12, 2011
  7. Jonathan NiederDec 12, 2011
  8. Jonathan NiederDec 12, 2011
  9. Thomas RastDec 12, 2011
  10. Jonathan NiederDec 12, 2011
  11. Junio C HamanoDec 12, 2011
  12. Junio C HamanoDec 12, 2011
  13. Thomas RastDec 12, 2011
  14. Jeff KingDec 12, 2011
  15. Junio C HamanoDec 12, 2011
  16. Jonathan NiederDec 12, 2011

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.