git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Duy Nguyen <pclouds@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [PATCH] tests: turn on network daemon tests by default
Date: Wed, 12 Feb 2014 16:47:53 -0500	[thread overview]
Message-ID: <20140212214753.GA6799@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqzjlxnqvw.fsf@gitster.dls.corp.google.com>

On Tue, Feb 11, 2014 at 03:58:27PM -0800, Junio C Hamano wrote:

> Sure. One immediate complaint is that I would probably need to do
> something like this in the build automation:
> 
> 	if testing a branch without this patch
>         then
> 		: do nothing
> 	else
> 		GIT_TEST_GIT_DAEMON=false
> 	fi
> 
> Arguably, it is the fault of the current/original code that treated
> *any* non-empty value that is set in the environment variable as
> "true"---if it paid attention to GIT_TEST_GIT_DAEMON=NoThanks, we
> wouldn't have to have a workaround like this.

Yes, I didn't really think about build config that works reliably
between both versions (though personally, I think you should be building
with GIT_TEST_GIT_DAEMON=true :) ).

> I wonder if GIT_TEST_X=$(test_tristate "$GIT_TEST_X") pattern can be
> made a bit more friendly, though.  For example, can we behave
> differently depending on the reason why $GIT_TEST_X is empty?
> 
>  - People who have *not* been opting in to the expensive tests have
>    not done anything special; GIT_TEST_X environment variable did
>    not exist for them (i.e. unset), and we used to skip when
>    "$GIT_TEST_X" is an empty string.
> 
>  - We want to encourage people who do not care to run these tests.
>    If people do not do anything, their $GIT_TEST_X will continue to
>    be an empty string without GIT_TEST_X variable in the
>    environment.
> 
> If we let people who *do* want to opt out of the expensive tests by
> explicitly setting $GIT_TEST_X to an empty string in the new scheme,
> wouldn't the transition go a lot smoother?

Hmm. So you are suggesting that the old code treated "undefined" and
"empty" the same (as "false"). But that in the new code, we would treat
them _differently_, taking undefined to mean "auto" and empty to mean
"false". I suppose that works, but it is rather unfortunate that the end
state we are left with (for all time) makes such a confusing and subtle
distinction.

I think this should work OK with the existing Makefile conventions. That
is, we do not ever set GIT_TEST_HTTPD in the Makefile ourselves, but
rely on it being either unset or set to whatever the user likes (this is
opposed to something like CFLAGS, where the distinction is long gone).

So I'm not excited about it, but I do not think there is any other
loophole through which we can maintain compatibility. If that's
important, I think we have to do it.

> The caller may have to pass the name of the variable:
> 
> 	GIT_TEST_DAEMON=$(test_tristate GIT_TEST_DAEMON)

I don't think that's a big deal. I actually was tempted to just make
this:

  test_normalize_tristate GIT_TEST_DAEMON

in the first place, since you would always want to look at the
normalized value from there on out.

> and then the callee may become
> 
> 	test_tristate () {
> 		variable=$1
>                 if eval "test x\"\${$variable+isset}\" = xisset"

Hmm, today I learned about "{foo:+bar}" versus "${foo+bar}". I'm not
sure how that bit of shell trivia escaped me for so many years.

-Peff

  reply	other threads:[~2014-02-12 21:48 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 15:10 [PATCH 0/6] Fix the shallow deepen bug with no-done Nguyễn Thái Ngọc Duy
2014-02-06 15:10 ` [PATCH 1/6] test: rename http fetch and push test files Nguyễn Thái Ngọc Duy
2014-02-06 19:33   ` Jeff King
2014-02-06 15:10 ` [PATCH 2/6] t5538: fix default http port Nguyễn Thái Ngọc Duy
2014-02-06 19:35   ` Jeff King
2014-02-07 23:47     ` Jeff King
2014-02-08  7:36       ` Duy Nguyen
2014-02-10 14:39         ` Jeff King
2014-02-10 18:23           ` Junio C Hamano
2014-02-10 19:15             ` Jeff King
2014-02-10 19:16               ` Jeff King
2014-02-10 21:29               ` [PATCH] tests: turn on network daemon tests by default Jeff King
2014-02-11 19:51                 ` Junio C Hamano
2014-02-11 20:04                   ` Jeff King
2014-02-11 23:58                     ` Junio C Hamano
2014-02-12 21:47                       ` Jeff King [this message]
2014-02-12 22:34                         ` Junio C Hamano
2014-02-13 19:35                           ` Junio C Hamano
2014-02-14  9:58                             ` Jeff King
2014-02-14 16:13                               ` Junio C Hamano
2014-02-12 19:06                     ` Junio C Hamano
2014-02-12 22:12                       ` Jeff King
2014-02-13  1:22                         ` Duy Nguyen
2014-02-13 13:21                           ` [PATCH] t5537: move http tests out to t5539 Nguyễn Thái Ngọc Duy
2014-02-13 20:14                             ` Junio C Hamano
2014-02-06 15:10 ` [PATCH 3/6] pack-protocol.txt: clarify 'obj-id' in the last ACK after 'done' Nguyễn Thái Ngọc Duy
2014-02-06 18:54   ` Junio C Hamano
2014-02-06 15:10 ` [PATCH 4/6] protocol-capabilities.txt: refer multi_ack_detailed back to pack-protocol.txt Nguyễn Thái Ngọc Duy
2014-02-06 15:10 ` [PATCH 5/6] protocol-capabilities.txt: document no-done Nguyễn Thái Ngọc Duy
2014-02-06 18:55   ` Junio C Hamano
2014-02-06 19:40   ` Jeff King
2014-02-06 15:10 ` [PATCH 6/6] fetch-pack: fix deepen shallow over smart http with no-done cap Nguyễn Thái Ngọc Duy
2014-02-06 19:16   ` Junio C Hamano
2014-02-07  0:52     ` Duy Nguyen
2014-02-06 19:35   ` Eric Sunshine
2014-02-06 19:42   ` Jeff King
2014-02-07 18:01   ` Junio C Hamano
2014-02-07 23:39     ` Duy Nguyen
2014-02-10 18:18       ` Junio C Hamano
2014-02-06 19:31 ` [PATCH 0/6] Fix the shallow deepen bug with no-done Junio C Hamano
2014-02-06 19:44   ` Jeff King
2014-02-07  0:47   ` Duy Nguyen
2014-02-07 19:20     ` Jonathan Nieder
2014-02-07 20:03       ` 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=20140212214753.GA6799@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=spearce@spearce.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;
as well as URLs for NNTP newsgroup(s).