public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Ramsay Jones <ramsay@ramsay1•demon.co.uk>
Cc: GIT Mailing-list <git@vger•kernel.org>,
	Ilya Bobyr <ilya.bobyr@gmail•com>
Subject: Re: [PATCH/RFC] t0000-*.sh: Fix the GIT_SKIP_TESTS sub-tests
Date: Tue, 20 May 2014 14:33:33 -0700	[thread overview]
Message-ID: <xmqqppj8rv82.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <537BC8A2.9060009@ramsay1.demon.co.uk> (Ramsay Jones's message of "Tue, 20 May 2014 22:26:58 +0100")

Ramsay Jones <ramsay@ramsay1•demon.co.uk> writes:

> This patch is an RFC, because I take a different approach to the
> above solution, only because the diff is much smaller and easier
> to read! Is it a better solution?
>
> ATB,
> Ramsay Jones
>
>  t/t0000-basic.sh | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
> index 8345c8a..373ad8f 100755
> --- a/t/t0000-basic.sh
> +++ b/t/t0000-basic.sh
> @@ -296,8 +296,9 @@ test_expect_success 'test --verbose-only' '
>  '
>  
>  test_expect_success 'GIT_SKIP_TESTS' "
> -	GIT_SKIP_TESTS='git.2' \
> -		run_sub_test_lib_test git-skip-tests-basic \
> +	GIT_SKIP_TESTS='git.2' && export GIT_SKIP_TESTS &&
> +	test_when_finished sane_unset GIT_SKIP_TESTS &&
> +	run_sub_test_lib_test git-skip-tests-basic \
>  		'GIT_SKIP_TESTS' <<-\\EOF &&

The original is clearly wrong if run_sub_test_lib_test is a shell
function.  I thought we hunted those down and killed them already,
but apparently we didn't.

I think exporting the variable and then clearing it in
test-when-finished is fine, and doing the export and run in a
subshell so that you do not have to clear is also fine.

>  	for i in 1 2 3
>  	do
> @@ -315,8 +316,9 @@ test_expect_success 'GIT_SKIP_TESTS' "
>  "
>  
>  test_expect_success 'GIT_SKIP_TESTS several tests' "
> -	GIT_SKIP_TESTS='git.2 git.5' \
> -		run_sub_test_lib_test git-skip-tests-several \
> +	GIT_SKIP_TESTS='git.2 git.5' && export GIT_SKIP_TESTS &&
> +	test_when_finished sane_unset GIT_SKIP_TESTS &&
> +	run_sub_test_lib_test git-skip-tests-several \
>  		'GIT_SKIP_TESTS several tests' <<-\\EOF &&
>  	for i in 1 2 3 4 5 6
>  	do
> @@ -337,8 +339,9 @@ test_expect_success 'GIT_SKIP_TESTS several tests' "
>  "
>  
>  test_expect_success 'GIT_SKIP_TESTS sh pattern' "
> -	GIT_SKIP_TESTS='git.[2-5]' \
> -		run_sub_test_lib_test git-skip-tests-sh-pattern \
> +	GIT_SKIP_TESTS='git.[2-5]' && export GIT_SKIP_TESTS &&
> +	test_when_finished sane_unset GIT_SKIP_TESTS &&
> +	run_sub_test_lib_test git-skip-tests-sh-pattern \
>  		'GIT_SKIP_TESTS sh pattern' <<-\\EOF &&
>  	for i in 1 2 3 4 5 6
>  	do

  reply	other threads:[~2014-05-20 21:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 21:26 [PATCH/RFC] t0000-*.sh: Fix the GIT_SKIP_TESTS sub-tests Ramsay Jones
2014-05-20 21:33 ` Junio C Hamano [this message]
2014-05-20 21:40 ` Jonathan Nieder
2014-05-20 22:20   ` Ramsay Jones
2014-05-20 22:44     ` Jonathan Nieder
2014-05-20 23:33       ` Ramsay Jones

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=xmqqppj8rv82.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=ilya.bobyr@gmail$(echo .)com \
    --cc=ramsay@ramsay1$(echo .)demon.co.uk \
    /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