Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [RFC/PATCH] tests: optionally fail passed todo immediately
Date: Tue, 18 Dec 2012 21:38:20 -0800	[thread overview]
Message-ID: <7vzk1abnzn.fsf@alter.siamese.dyndns.org> (raw)

Add "--fail-passed-todo" option to stop the test immediately when a
test that is expected to fail succeeds.  After seeing the test stop,
the developer can go to the trash directory and inspect why it failed
to fail as expected.

I usually just insert "exit" after such test with an editor, but
an option like this might be easier to use.  I dunno.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Stopping immediately after a test that is failing (and expected
   to fail) and then going to the trash directory to inspect the
   status of the sandbox are the first two steps I often end up
   doing while fixing a bug.  It may make sense to add an option to
   cause the test to stop at a failure of test_expect_failure, but
   that is a separate topic.

 t/test-lib.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index f50f834..7b7cce6 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -176,6 +176,8 @@ do
 		debug=t; shift ;;
 	-i|--i|--im|--imm|--imme|--immed|--immedi|--immedia|--immediat|--immediate)
 		immediate=t; shift ;;
+	--fail-passed-todo)
+		fail_passed_todo=t; shift ;;
 	-l|--l|--lo|--lon|--long|--long-|--long-t|--long-te|--long-tes|--long-test|--long-tests)
 		GIT_TEST_LONG=t; export GIT_TEST_LONG; shift ;;
 	-h|--h|--he|--hel|--help)
@@ -307,6 +309,7 @@ test_failure_ () {
 test_known_broken_ok_ () {
 	test_fixed=$(($test_fixed+1))
 	say_color "" "ok $test_count - $@ # TODO known breakage"
+	test "$fail_passed_todo" = "" || { GIT_EXIT_OK=t; exit 1; }
 }
 
 test_known_broken_failure_ () {
-- 
1.8.1.rc2.196.g90926c8

                 reply	other threads:[~2012-12-19  5:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7vzk1abnzn.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox