git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Daniel Jacques <dnj@google.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 0/2] Add Windows support to the new RUNTIME_PREFIX design
Date: Tue, 27 Mar 2018 18:28:44 +0200 (DST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1803271817060.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz> (raw)
In-Reply-To: <CAD1RUU9XK837mdRwicMwM5qVApzz8o2e4Eg=B0LH3SRtLqG9WQ@mail.gmail.com>

Hi Dan,

On Tue, 27 Mar 2018, Daniel Jacques wrote:

> On Tue, Mar 27, 2018 at 11:54 AM Johannes Schindelin <
> Johannes.Schindelin@gmx.de> wrote:
> 
> > I guess we should add a test where we copy the `git` executable into a
> > subdirectory with the name "git" and call `git/git --exec-path` and
> > verify that its output matches our expectation?
> 
> I'm actually a little fuzzy on the testing model here.

Alright, I'll bite.

You are correct that the test must be contingent on the RUNTIME_PREFIX
prerequisite. This could be tested thusly:

	test_lazy_prereq RUNTIME_PREFIX '
		# test whether we built with RUNTIME_PREFIX support
		grep " -DRUNTIME_PREFIX" "$GIT_BUILD_DIR/GIT-CFLAGS"
	'

The subsequent test would run like this:

	test_expect_success RUNTIME_PREFIX '
		mkdir git &&
		cp "$GIT_BUILD_DIR/git$X" git/ &&
		path="$(git/git$X --exec-path)" &&
		case "$(echo "$path" | tr '\\' /)" in
		"$(pwd)/libexec/git-core") ;; # okay
		*)
			echo "Unexpected exec path: $path" >&2
			return 1
			;;
		esac
	'

I say "like this" because it is a little bit tricky to get right, in
particular when supporting Windows ;-)

For example, when building with Visual C, the dependencies' .dll files
need to be copied into the same directory as the .exe files because there
is no good central place to put them (don't get me started on the problems
incurred by some software copying some random OpenSSL version's
ssleay32.dll into C:\Windows\system32, unless you buy me beer all night
and want to be entertained). And that obviously would fail with this
approach.

> As things are, this test will only work if Git is relocatable; however,
> the test suite doesn't seem to be equipped to build multiple versions of
> Git for different tests.  From this I conclude that the right approach
> would be to make a test that runs conditional on RUNTIME_PREFIX being
> set, but I'm not familiar enough with the testing framework to be
> confident that this is correct, or really how to go about writing such a
> test.
> 
> A simple grep suggests that the current test suite doesn't seem to have any
> RUNTIME_PREFIX-specific tests. When I've been running the test suites, I've
> been doing it with a "config.mak" file that explicitly enables
> RUNTIME_PREFIX to get the runtime prefix code tested against the standard
> Git testing suites.

Indeed, this would be the first test.

>  From a Git maintainer's perspective, would such a test be a
>  prerequisite for landing this patch series, or is this a good candidate
>  for follow-up work to improve our testing coverage?

I cannot speak for Junio, but from my understanding he would probably be
fine without such a test. Or a separate patch at a later stage that
introduces that.

Or something completely different such as a helper in t/helper/ that
always succeeds if RUNTIME_PREFIX is not defined, otherwise passes argv[1]
as parameter to git_resolve_executable_dir() and outputs that. Would be a
lot more robust than what I described above. But I would want for Duy's
test-tool patch series to land first because I would hate to introduce
*yet* another stand-alone .exe in t/helper/.

Ciao,
Dscho

  reply	other threads:[~2018-03-27 18:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-25 20:51 [PATCH v7 0/3] RUNTIME_PREFIX relocatable Git Dan Jacques
2018-03-25 20:51 ` [PATCH v7 1/3] Makefile: generate Perl header from template file Dan Jacques
2018-03-25 20:51 ` [PATCH v7 2/3] Makefile: add Perl runtime prefix support Dan Jacques
2018-03-25 20:51 ` [PATCH v7 3/3] exec_cmd: RUNTIME_PREFIX on some POSIX systems Dan Jacques
2018-03-25 21:15 ` [PATCH v7 0/3] RUNTIME_PREFIX relocatable Git Ævar Arnfjörð Bjarmason
2018-03-26 13:03   ` Daniel Jacques
2018-03-26 14:08     ` Ævar Arnfjörð Bjarmason
2018-03-26 14:55       ` Daniel Jacques
2018-03-26  6:01 ` Junio C Hamano
2018-03-26 13:00   ` Daniel Jacques
2018-03-26 21:16     ` Johannes Schindelin
2018-03-26 21:31 ` [PATCH 0/2] Add Windows support to the new RUNTIME_PREFIX design Johannes Schindelin
2018-03-27 14:37   ` Daniel Jacques
2018-03-27 15:54     ` Johannes Schindelin
2018-03-27 16:05       ` Daniel Jacques
2018-03-27 16:28         ` Johannes Schindelin [this message]
2018-03-28 17:12         ` Junio C Hamano
2018-03-29 14:54           ` Johannes Schindelin
2018-03-26 21:31 ` [PATCH 1/2] exec_cmd: provide a new-style RUNTIME_PREFIX helper for Windows Johannes Schindelin
2018-03-26 21:31 ` [PATCH 2/2] mingw/msvc: use the new-style RUNTIME_PREFIX helper Johannes Schindelin

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=nycvar.QRO.7.76.6.1803271817060.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz \
    --to=johannes.schindelin@gmx.de \
    --cc=dnj@google.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).