git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v3 5/5] TAP: Make sure there's a newline before "ok" under harness
Date: Tue, 15 Jun 2010 22:32:58 +0000	[thread overview]
Message-ID: <1276641178-32420-6-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <AANLkTimxE0mqmitRzlXjSAO6v7IOEg4guUnRlzJUyIF1@mail.gmail.com>

Some tests in the testsuite will emit a line that doesn't end with a
newline, right before we're about to output "ok" or "not ok". This
breaks the TAP output with "Tests out of sequence" errors since a TAP
harness can't understand this:

    ok 1 - A test
    [some output here]ok 2 - Another test
    ok 3 - Yet another test

Work around it by emitting an empty line before we're about to say
"ok" or "not ok", but only if we're running under --verbose and
HARNESS_ACTIVE=1 is set, which'll only be the case when running under
a harnesses like prove(1).

I think it's better to do this than fix each tests by adding `&& echo'
everywhere. More tests might be added that break TAP in the future,
and a human isn't going to look at the extra whitespace, since
HARNESS_ACTIVE=1 always means a harness is reading it.

The tests that had issues were:

   t1007, t3410, t3413, t3409, t3414, t3415, t3416, t3412, t3404,
   t5407, t7402, t7003, t9001

With this workaround the entire test suite runs without errors under:

    prove -j 10 ./t[0-9]*.sh :: --verbose

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/test-lib.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 37987d7..86a46bf 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -369,6 +369,9 @@ test_run_ () {
 	eval >&3 2>&4 "$1"
 	eval_ret=$?
 	eval >&3 2>&4 "$test_cleanup"
+	if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"; then
+		echo ""
+	fi
 	return 0
 }
 
-- 
1.7.1.251.g92a7

      parent reply	other threads:[~2010-06-15 22:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 15:22 [PATCH v2 0/3] Make the Git tests emit TAP format Ævar Arnfjörð Bjarmason
2010-06-09 15:22 ` [PATCH v2 1/3] Make test-lib.sh emit valid " Ævar Arnfjörð Bjarmason
2010-06-14 22:01   ` Jakub Narebski
2010-06-14 22:29     ` Ævar Arnfjörð Bjarmason
2010-06-09 15:22 ` [PATCH v2 2/3] Skip tests in a way that makes sense under TAP Ævar Arnfjörð Bjarmason
2010-06-09 15:24 ` [PATCH v2 3/3] We use TAP so the Perl test can run without scaffolding Ævar Arnfjörð Bjarmason
2010-06-14 21:49 ` [PATCH v2 0/3] Make the Git tests emit TAP format Jakub Narebski
2010-06-14 22:10   ` Ævar Arnfjörð Bjarmason
2010-06-14 23:16     ` Ævar Arnfjörð Bjarmason
2010-06-15  3:08       ` Junio C Hamano
2010-06-15  3:10         ` Ævar Arnfjörð Bjarmason
2010-06-15 15:17     ` Ævar Arnfjörð Bjarmason
2010-06-15 16:42       ` Andreas Ericsson
2010-06-15 16:49         ` Ævar Arnfjörð Bjarmason
2010-06-15 22:32       ` [PATCH v3 0/5] TAP support for Git Ævar Arnfjörð Bjarmason
2010-06-15 22:32       ` [PATCH v3 1/5] Make test-lib.sh emit valid TAP format Ævar Arnfjörð Bjarmason
2010-06-15 22:32       ` [PATCH v3 2/5] Skip tests in a way that makes sense under TAP Ævar Arnfjörð Bjarmason
2010-06-15 22:32       ` [PATCH v3 3/5] We use TAP so the Perl test can run without scaffolding Ævar Arnfjörð Bjarmason
2010-06-15 22:32       ` [PATCH v3 4/5] TAP: Say "pass" rather than "ok" on an empty line Ævar Arnfjörð Bjarmason
2010-06-15 22:32       ` Ævar Arnfjörð Bjarmason [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1276641178-32420-6-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).