All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH] WIP: Report intra-test progress with TAP subtests
Date: Wed, 11 Aug 2010 00:28:30 -0500	[thread overview]
Message-ID: <20100811052830.GA1355@burratino> (raw)
In-Reply-To: <1281473829-2102-1-git-send-email-avarab@gmail.com>

Ævar Arnfjörð Bjarmason wrote:

> Here's an attempt at that, I've convented test_commit, test_merge and
> test_cmp to report intra-test progress. The only problem is that it
> doesn't quite work.

I forgot to say: thanks for the demonstration.  This is neat stuff.

> 	eval >&3 2>&4 "$1"
> 
> So when you run it you'll just get:
> 
>     $ ./t0100-previous.sh
>         1..1
>     ok 1 - branch -d @{-1}
>     ok 2 - branch -d @{-12} when there is not enough switches yet
>         1..2
>     ok 3 - merge @{-1}
>     ok 4 - merge @{-1} when there is not enough switches yet
>     # passed all 4 test(s)
>     1..4
> 
> Is there some filedescriptor saving/redirection magic I can do within
> the subtest code to print things to the *real* stdout and stderr

Descriptor 5 is a pass-through for stdout: see v0.99.5~24^2~4
(Trapping exit in tests, 2005-08-10).

Do you need a pass-through for stderr, too, or was that theoretical?

> @@ -290,20 +295,38 @@ test_tick () {
>  
>  test_commit () {
>  	file=${2:-"$1.t"}
> -	echo "${3-$1}" > "$file" &&
> -	git add "$file" &&
> -	test_tick &&
> -	git commit -m "$1" &&
> -	git tag "$1"
> +	subtest_count=$(($subtest_count + 1))
> +
> +	if echo "${3-$1}" > "$file" &&
> +		git add "$file" &&
> +		test_tick &&
> +		git commit -m "$1" &&
> +		git tag "$1"
> +	then
> +		test_ok_ "test_commit file:<$file> message:<$1> contents<${3-$1}>"
> +		true
> +	else
> +		test_failure_ "test_commit file:<$file> message:<$1> contents<${3-$1}>"
> +		true
> +	fi

This would make the test continue after the subtest, right?  Is that
intended?

  parent reply	other threads:[~2010-08-11  5:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-10 20:57 [RFC/PATCH] WIP: Report intra-test progress with TAP subtests Ævar Arnfjörð Bjarmason
2010-08-11  0:44 ` Jonathan Nieder
2010-08-11  0:55   ` Ævar Arnfjörð Bjarmason
2010-08-11  1:04     ` Jonathan Nieder
2010-08-11  6:44       ` Johannes Sixt
2010-08-11  5:28 ` Jonathan Nieder [this message]
2010-08-11 16:41   ` Ævar Arnfjörð Bjarmason

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=20100811052830.GA1355@burratino \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.