All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH] t/interop: allow tests to run "git env--helper"
Date: Tue, 10 Jan 2023 08:39:20 -0500	[thread overview]
Message-ID: <Y71qiCs+oAS2OegH@coredump.intra.peff.net> (raw)

The interop test library sets up wrappers "git.a" and "git.b" to
represent the two versions to be tested. It also wraps vanilla "git" to
report an error, with the goal of catching tests which accidentally fail
to use one of the version-specific wrappers (which could invalidate the
tests in a very subtle way).

As a result, t/interop/i5700 has refused to run since 3b072c577b (tests:
replace test_tristate with "git env--helper", 2019-06-21). The problem
is that lib-git-daemon.sh uses "git env--helper" to decide whether to
run daemon tests, which triggers the vanilla wrapper. That produces an
error, and we think that the daemon tests are disabled.

Let's make our wrapper a little smarter, and allow env--helper
specifically. It's not an interesting part of Git to test for interop,
and it's used extensively in test setup. The matching is rudimentary
(e.g., it would not catch "git --some-arg env--helper", but it's enough
for our small set of interop tests).

Let's likewise improve the error message from the wrapper (when it does
complain) to show the arguments to git. That makes debugging a situation
like this much easier, since otherwise you are clueless about who is
calling "git" and why.

Signed-off-by: Jeff King <peff@peff.net>
---
Obviously nobody has run these for a while. I just happened to do so
today while investigating something else. Maybe they're not worth
keeping around, and we should consider it all a failed experiment.
But it's easy enough to fix in the meantime.

Arguably "git env--helper" should be "test-tool", which wouldn't run
into this problem, but it's probably not worth refactoring it for the
sake of these tests.

By the way, if you do try to run the whole set of tests, note that Git
v1.0.0 no longer builds with modern openssl (you can't declare a BIGNUM
anymore; you have to get it from BN_new()), and thus i5500 fails. You
can work around it with:

  # this gets baked into GIT-BUILD-OPTIONS
  make GIT_INTEROP_MAKE_OPTS=NO_OPENSSL=Nope

  # and now interop tests will use it for building other versions
  cd t/interop
  make

 t/interop/interop-lib.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/t/interop/interop-lib.sh b/t/interop/interop-lib.sh
index 3e0a2911d4..f65baa607d 100644
--- a/t/interop/interop-lib.sh
+++ b/t/interop/interop-lib.sh
@@ -67,9 +67,18 @@ generate_wrappers () {
 	mkdir -p .bin &&
 	wrap_git .bin/git.a "$DIR_A" &&
 	wrap_git .bin/git.b "$DIR_B" &&
+	GENERIC_GIT="$TEST_DIRECTORY/../bin-wrappers/git" &&
+	export GENERIC_GIT &&
 	write_script .bin/git <<-\EOF &&
-	echo >&2 fatal: test tried to run generic git
-	exit 1
+	case "$1" in
+	env--helper)
+		exec "$GENERIC_GIT" "$@"
+		;;
+	*)
+		echo >&2 fatal: test tried to run generic git: $*
+		exit 1
+		;;
+	esac
 	EOF
 	PATH=$(pwd)/.bin:$PATH
 }
-- 
2.39.0.508.g93b13bde48

             reply	other threads:[~2023-01-10 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 13:39 Jeff King [this message]
2023-01-12 16:03 ` [PATCH] env-helper: move this built-in to to "test-tool env-helper" Ævar Arnfjörð Bjarmason
2023-01-12 16:39   ` Jeff King
2023-01-13 20:17     ` Junio C Hamano
2023-01-14 17:43   ` Andrei Rybak
2023-01-15  2:06     ` Junio C Hamano

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=Y71qiCs+oAS2OegH@coredump.intra.peff.net \
    --to=peff@peff.net \
    --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.