git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: trygveaa@gmail.com
Cc: git@vger.kernel.org, gitster@pobox.com, larsxschneider@gmail.com,
	chriscool@tuxfamily.org, Johannes.Schindelin@gmx.de,
	pranit.bauva@gmail.com, tanushreetumane@gmail.com,
	mirucam@gmail.com, Bagas Sanjaya <bagasdotme@gmail.com>
Subject: [PATCH v2] test: add test for git bisect skip with --term* arguments
Date: Wed, 21 Apr 2021 11:08:10 +0700	[thread overview]
Message-ID: <20210421040808.14185-1-bagasdotme@gmail.com> (raw)
In-Reply-To: <20210418151459.GC10839@aaberge.net>

Trygve Aaberge reported the current git bisect breakage on [1].
After starting bisection with --term-new and --term-old arguments to git
bisect start, skipping with git bisect skip does not change HEAD as
expected.

Let's add the test to catch this breakage.

[1]: https://lore.kernel.org/git/20210418151459.GC10839@aaberge.net/

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---

Changes from v1:
  * style changes requested by Junio
  * rename test script and edit test description to be more descriptive
  * remove exec </dev/null (I don't know what it means)
  * repo initialization is now on test_expect_success block (as
    requested by Junio)
  
 t/t6031-bisect-skip-with-term.sh | 36 ++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100755 t/t6031-bisect-skip-with-term.sh

diff --git a/t/t6031-bisect-skip-with-term.sh b/t/t6031-bisect-skip-with-term.sh
new file mode 100755
index 0000000000..f1e1c4c1a2
--- /dev/null
+++ b/t/t6031-bisect-skip-with-term.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2021 Bagas Sanjaya
+#
+
+test_description='Tests skipping bisect which the bisection is started with --term* arguments'
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+# hash variables to be used in bisection test
+HASH_SKIPPED_FROM=
+HASH_SKIPPED_TO=
+
+# test repo initialization
+test_expect_success 'initialize testing repo with 20 commits' '
+	for i in $(test_seq 1 20); do
+		echo $i >>test &&
+		git add test && git commit -m "commit $i" &&
+		test_tick
+	done
+'
+
+# actual bisection test
+test_expect_success 'test moving HEAD when skip bisecting' '
+	git bisect start --term-new=ok --term-old=whoops HEAD HEAD~9 &&
+	HASH_SKIPPED_FROM=$(git rev-parse --verify HEAD) &&
+	git bisect skip &&
+	HASH_SKIPPED_TO=$(git rev-parse --verify HEAD) &&
+	test $HASH_SKIPPED_FROM != $HASH_SKIPPED_TO
+'
+
+test_done

base-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a
-- 
2.25.1


  parent reply	other threads:[~2021-04-21  4:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 15:14 Using --term-* with bisect breaks skip Trygve Aaberge
2021-04-19  6:58 ` Bagas Sanjaya
2021-04-19  8:39   ` Trygve Aaberge
2021-04-19 12:50     ` Bagas Sanjaya
2021-04-19 18:55 ` Junio C Hamano
2021-04-19 19:32   ` Trygve Aaberge
2021-04-20 12:34 ` [PATCH] test: add test for git bisect skip with --term* arguments Bagas Sanjaya
2021-04-20 18:08   ` Junio C Hamano
2021-04-21  4:08 ` Bagas Sanjaya [this message]
2021-04-21 17:25   ` [PATCH v2] " Junio C Hamano
2021-04-22  5:16     ` Bagas Sanjaya

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=20210421040808.14185-1-bagasdotme@gmail.com \
    --to=bagasdotme@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=larsxschneider@gmail.com \
    --cc=mirucam@gmail.com \
    --cc=pranit.bauva@gmail.com \
    --cc=tanushreetumane@gmail.com \
    --cc=trygveaa@gmail.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.
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 NNTP newsgroup(s).