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

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

 



Thomas Rast <trast@xxxxxxxxxxxxxxx> writes:

> So far, test-terminal.perl did not care at all about the stdin (that
> is, leave it as-is).  This mostly works well, but git-shortlog is a
> problem:
>
> * It takes decisions based on isatty(0).  (No test checks this, but
>   compare 'git shortlog </dev/null' with 'git shortlog' in a
>   terminal.)
>
> * It reads all of stdin if !isatty(0) and no arguments were passed.
>
> Because of the latter, t7006.58ff cause unexpected results if you do:
>
>   git rev-list <range> |
>   while read sha; do
>     git checkout sha
>     make test
>   done

In the above, lack of dollar-sign in "git checkout $sha" is obvious ;-)
but I think it is a bug that you are not running make with its stdin
redirected from /dev/null in the first place.

Perhaps "make test" should do that for all tests, not just this terminal
related one? Doing it this way we do not have to worry about other tests
reading from the standard input by mistake.

-- >8 --
Subject: Do not let the tests read from standard input stream

Consider running a loop like this:

   git rev-list <range> |
   while read commit
   do
	git checkout $commit && make test || break
   done

If any of the test reads from the standard input, we may end up running a
test for just one commit (and while running the test for that commit, the
remainder of the rev-list output is consumed by the test). A workaround
would be to redirect like this:

    git checkout $commit && make test </dev/null || break

but the Makefile should be doing that for us instead.

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index ed82320..7a85237 100644
--- a/Makefile
+++ b/Makefile
@@ -2239,7 +2239,7 @@ export NO_SVN_TESTS
 ### Testing rules
 
 test: all
-	$(MAKE) -C t/ all
+	$(MAKE) -C t/ all </dev/null
 
 test-ctype$X: ctype.o
 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]