public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Jens Lehmann <Jens.Lehmann@web•de>,
	Git Mailing List <git@vger•kernel.org>
Subject: Re: [PATCH] t5541: don't call start_httpd after sourcing lib-terminal.sh
Date: Fri, 14 Mar 2014 14:47:14 -0700	[thread overview]
Message-ID: <xmqqtxb0fo65.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140314213715.GA10299@sigill.intra.peff.net> (Jeff King's message of "Fri, 14 Mar 2014 17:37:15 -0400")

Jeff King <peff@peff•net> writes:

> One option would be to _always_ define test_terminal....

That looks like the right direction to go.

> Something like the patch below (looks like we should be using $PERL_PATH
> instead of "perl", too).

;-)  Also a SP between test_terminal and (), perhaps.

> diff --git a/t/lib-terminal.sh b/t/lib-terminal.sh
> index 9a2dca5..55b708f 100644
> --- a/t/lib-terminal.sh
> +++ b/t/lib-terminal.sh
> @@ -1,35 +1,36 @@
>  # Helpers for terminal output tests.
>  
> -test_expect_success PERL 'set up terminal for tests' '
> +# Catch tests which should depend on TTY but forgot to. There's no need
> +# to check that TTY is set here. If the test declared it and we are running
> +# it, then it is set.
> +test_terminal() {
> +	if ! test_declared_prereq TTY
> +	then
> +		echo >&4 "test_terminal: need to declare TTY prerequisite"
> +		return 127
> +	fi
> +	perl "$TEST_DIRECTORY"/test-terminal.perl "$@"
> +}
> +
> +test_lazy_prereq TTY '
> +	test_have_prereq PERL &&
> +
>  	# Reading from the pty master seems to get stuck _sometimes_
>  	# on Mac OS X 10.5.0, using Perl 5.10.0 or 5.8.9.
>  	#
>  	# Reproduction recipe: run
>  	#
>  	#	i=0
>  	#	while ./test-terminal.perl echo hi $i
>  	#	do
>  	#		: $((i = $i + 1))
>  	#	done
>  	#
>  	# After 2000 iterations or so it hangs.
>  	# https://rt.cpan.org/Ticket/Display.html?id=65692
>  	#
> -	if test "$(uname -s)" = Darwin
> -	then
> -		:
> -	elif
> -		perl "$TEST_DIRECTORY"/test-terminal.perl \
> -			sh -c "test -t 1 && test -t 2"
> -	then
> -		test_set_prereq TTY &&
> -		test_terminal () {
> -			if ! test_declared_prereq TTY
> -			then
> -				echo >&4 "test_terminal: need to declare TTY prerequisite"
> -				return 127
> -			fi
> -			perl "$TEST_DIRECTORY"/test-terminal.perl "$@"
> -		}
> -	fi
> +	test "$(uname -s)" != Darwin &&
> +
> +	perl "$TEST_DIRECTORY"/test-terminal.perl \
> +		sh -c "test -t 1 && test -t 2"
>  '

  reply	other threads:[~2014-03-14 21:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 21:18 [PATCH] t5541: don't call start_httpd after sourcing lib-terminal.sh Jens Lehmann
2014-03-14 21:37 ` Jeff King
2014-03-14 21:47   ` Junio C Hamano [this message]
2014-03-14 21:57     ` [PATCH] t/lib-terminal: make TTY a lazy prerequisite Jeff King
2014-03-14 22:05       ` Junio C Hamano
2014-03-15  1:55         ` Jeff King
2014-03-14 22:13       ` Jens Lehmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqtxb0fo65.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Jens.Lehmann@web$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox