From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
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 14:34:52 -0800 [thread overview]
Message-ID: <xmqq38jom037.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140212214753.GA6799@sigill.intra.peff.net> (Jeff King's message of "Wed, 12 Feb 2014 16:47:53 -0500")
Jeff King <peff@peff•net> writes:
> test_normalize_tristate GIT_TEST_DAEMON
Heh, great minds think alike. This is what I am playing with,
without committing (because I do like your "ask config if this is a
kind of various boolean 'false' representations, which I haven't
managed to add to it).
t/lib-git-daemon.sh | 2 +-
t/lib-httpd.sh | 2 +-
t/test-lib-functions.sh | 45 +++++++++++++++++++++++++++------------------
3 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
index 36106de..615bf5d 100644
--- a/t/lib-git-daemon.sh
+++ b/t/lib-git-daemon.sh
@@ -16,7 +16,7 @@
# stop_git_daemon
# test_done
-GIT_TEST_GIT_DAEMON=$(test_tristate "$GIT_TEST_GIT_DAEMON")
+test_tristate GIT_TEST_GIT_DAEMON
if test "$GIT_TEST_GIT_DAEMON" = false
then
skip_all="git-daemon testing disabled (unset GIT_TEST_GIT_DAEMON to enable)"
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 583fb14..f9c2e22 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -30,7 +30,7 @@
# Copyright (c) 2008 Clemens Buchacher <drizzd@aon•at>
#
-GIT_TEST_HTTPD=$(test_tristate "$GIT_TEST_HTTPD")
+test_tristate GIT_TEST_HTTPD
if test "$GIT_TEST_HTTPD" = false
then
skip_all="Network testing disabled (unset GIT_TEST_HTTPD to enable)"
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 3cc09c0..21c5214 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -716,27 +716,36 @@ perl () {
command "$PERL_PATH" "$@"
}
-# Normalize the value given in $1 to one of "true", "false", or "auto". The
-# result is written to stdout. E.g.:
+# Given a variable $1, normalize the value of it to one of "true",
+# "false", or "auto" and store the result to it.
#
-# GIT_TEST_HTTPD=$(test_tristate "$GIT_TEST_HTTPD")
+# test_tristate GIT_TEST_HTTPD
#
+# A variable set to an empty string is set to 'false'.
+# A variable set to 'false' or 'auto' keeps its value.
+# Anything else is set to 'true'.
+# An unset variable defaults to 'auto'.
+#
+# The last rule is to allow people to set the variable to an empty
+# string and export it to decline testing the particular feature
+# for versions both before and after this change. We used to treat
+# both unset and empty variable as a signal for "do not test" and
+# took any non-empty string as "please test".
+
test_tristate () {
- case "$1" in
- ""|auto)
- echo auto
- ;;
- *)
- # Rely on git-config to handle all the variants of
- # true/1/on/etc that we allow.
- if ! git -c magic.hack="$1" config --bool magic.hack 2>/dev/null
- then
- # If git-config failed, it was some non-bool value like
- # YesPlease. Default this to "true" for historical
- # compatibility.
- echo true
- fi
- esac
+ if eval "test x\"\${$1+isset}\" = xisset"
+ then
+ # explicitly set
+ eval "
+ case \"\$$1\" in
+ '') $1=false ;;
+ false | auto) ;;
+ *) $1=true ;;
+ esac
+ "
+ else
+ eval "$1=auto"
+ fi
}
# Exit the test suite, either by skipping all remaining tests or by
next prev parent reply other threads:[~2014-02-12 22:35 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
2014-02-12 22:34 ` Junio C Hamano [this message]
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=xmqq38jom037.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=pclouds@gmail$(echo .)com \
--cc=peff@peff$(echo .)net \
--cc=spearce@spearce$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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