git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Allow running the test suite against installed git
@ 2009-03-13 15:45 Michael J Gruber
  2009-03-13 15:45 ` [PATCH 1/2] test-lib.sh: Test for presence of git-init in the right path Michael J Gruber
  0 siblings, 1 reply; 7+ messages in thread
From: Michael J Gruber @ 2009-03-13 15:45 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Part 1 corrects only an inconsistency which does not matter as long as
you run tests against git compiled in a checkout only: There,
$GIT_EXEC_PATH contains git, in general it does not.

Part 2 allows running the test suite against a git installed anywhere in
the file system. This has at least 2 use cases:
- Test an installed distro package after the installation.
- Run easily current tests against older versions, or vice versa, if you
  have those versions installed somewhere.

Note that one still needs git compiled in git.git for test helpers etc.,
and also because I did not adjust the paths to templates and such. I did
not really feel a need for that.

Also, t0000 there is still one explicit use of "../git" which is fine
because it simply tests for the presence of a built, which we need
anyways.

Michael J Gruber (2):
  test-lib.sh: Test for presence of git-init in the right path.
  test-lib.sh: Allow running the test suite against installed git

 t/test-lib.sh |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] test-lib.sh: Test for presence of git-init in the right path.
  2009-03-13 15:45 [PATCH 0/2] Allow running the test suite against installed git Michael J Gruber
@ 2009-03-13 15:45 ` Michael J Gruber
  2009-03-13 15:45   ` [PATCH 2/2] test-lib.sh: Allow running the test suite against installed git Michael J Gruber
  0 siblings, 1 reply; 7+ messages in thread
From: Michael J Gruber @ 2009-03-13 15:45 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

It just happens so that when GIT_EXEC_PATH points to a compiled checkout
of git.git it contains "git". Since this is not true in general make
test-lib check for "git-init" which is always in GIT_EXEC_PATH.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/test-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7a847ec..b9da86e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -454,7 +454,7 @@ test_create_repo () {
 	repo="$1"
 	mkdir -p "$repo"
 	cd "$repo" || error "Cannot setup test environment"
-	"$GIT_EXEC_PATH/git" init "--template=$owd/../templates/blt/" >&3 2>&4 ||
+	"$GIT_EXEC_PATH/git-init" "--template=$owd/../templates/blt/" >&3 2>&4 ||
 	error "cannot run git init -- have you built things yet?"
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
-- 
1.6.2.149.g6462

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] test-lib.sh: Allow running the test suite against installed git
  2009-03-13 15:45 ` [PATCH 1/2] test-lib.sh: Test for presence of git-init in the right path Michael J Gruber
@ 2009-03-13 15:45   ` Michael J Gruber
  2009-03-14 20:25     ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Michael J Gruber @ 2009-03-13 15:45 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Introduce variables externalpath and externalexecpath such that the test
suite can be run against a git which is installed at $externalpath with
subcommands at $externalexecpath. externalpath defaults to the git.git
checkout, externalexecpath defaults to $externalpath. Run the suite as

externalpath=somepath externalexecpath=someotherpath make test

but note that this requires and uses parts of a compiled git in the
git.git checkout: test helpers, templates and perl libraries are taken
from there.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/test-lib.sh |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index b9da86e..f6c467f 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -514,8 +514,14 @@ test_done () {
 TEST_DIRECTORY=$(pwd)
 if test -z "$valgrind"
 then
-	PATH=$TEST_DIRECTORY/..:$PATH
-	GIT_EXEC_PATH=$TEST_DIRECTORY/..
+	if test -z "$externalpath"
+	then
+		PATH=$TEST_DIRECTORY/..:$PATH
+		GIT_EXEC_PATH=$TEST_DIRECTORY/..
+	else
+		PATH=$externalpath:$TEST_DIRECTORY/..:$PATH
+		GIT_EXEC_PATH=${externalexecpath:-$externalpath}
+	fi
 else
 	make_symlink () {
 		test -h "$2" &&
-- 
1.6.2.149.g6462

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] test-lib.sh: Allow running the test suite against installed git
  2009-03-13 15:45   ` [PATCH 2/2] test-lib.sh: Allow running the test suite against installed git Michael J Gruber
@ 2009-03-14 20:25     ` Junio C Hamano
  2009-03-16 17:03       ` [PATCHv2 0/2] " Michael J Gruber
                         ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Junio C Hamano @ 2009-03-14 20:25 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git

Michael J Gruber <git@drmicha.warpmail.net> writes:

> Introduce variables externalpath and externalexecpath such that the test
> suite can be run against a git which is installed at $externalpath with
> subcommands at $externalexecpath. externalpath defaults to the git.git
> checkout, externalexecpath defaults to $externalpath. Run the suite as
>
> externalpath=somepath externalexecpath=someotherpath make test
>
> but note that this requires and uses parts of a compiled git in the
> git.git checkout: test helpers, templates and perl libraries are taken
> from there.

While I like the end result this series tries to achieve, may I suggest a
few things?

 - This is like GIT_SKIP_TESTS and GIT_TEST_HTTPD in that extra
   environments affect how the tests are run.  It would be much easier to
   use if the new environment variables are named similarly, prefixed with
   GIT_, in all caps, and with underscores between words.

 - When externalpath is given but not externalexecpath, you can deduce the
   latter from the former by running "$externalpath/git --exec-path",
   which makes running the tests against an installed git even easier.
   For example, I keep many git installations under $HOME/git-snap-vX.Y.Z,
   and it would be great if your patch allowed me to say something like:

    $ GIT_TEST_INSTALLED=$HOME/git-snap-v1.4.4.4/bin/git make test

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv2 0/2] Allow running the test suite against installed git
  2009-03-14 20:25     ` Junio C Hamano
@ 2009-03-16 17:03       ` Michael J Gruber
  2009-03-16 17:03       ` [PATCHv2 1/2] test-lib.sh: Test for presence of git-init in the right path Michael J Gruber
  2009-03-16 17:03       ` [PATCHv2 2/2] test-lib.sh: Allow running the test suite against installed git Michael J Gruber
  2 siblings, 0 replies; 7+ messages in thread
From: Michael J Gruber @ 2009-03-16 17:03 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Part 1 corrects only an inconsistency which does not matter as long as
you run tests against git compiled in a checkout only: There,
$GIT_EXEC_PATH contains git, in general it does not.

Part 2 allows running the test suite against a git installed anywhere in
the file system. This has at least 2 use cases:
- Test an installed distro package after the installation.
- Run easily current tests against older versions, or vice versa, if you
  have those versions installed somewhere.

Note that one still needs git compiled in git.git for test helpers etc.,
and also because I did not adjust the paths to templates and such. I did
not really feel a need for that.

Also, in t0000 there is still one explicit use of "../git" which is fine
because it simply tests for the presence of a build, which we need
anyways.

v2 incorporates feed-back by JCH: variables are named GIT_TEST_INSTALLED
and GIT_TEST_EXEC_PATH now, the latter defaulting to the output of
$GIT_TEST_INSTALLED/git --exec-path.

Also, we exit gracefully in case we cannot run $GIT_TEST_INSTALLED/git.

Michael J Gruber (2):
  test-lib.sh: Test for presence of git-init in the right path.
  test-lib.sh: Allow running the test suite against installed git

 t/test-lib.sh |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv2 1/2] test-lib.sh: Test for presence of git-init in the right path.
  2009-03-14 20:25     ` Junio C Hamano
  2009-03-16 17:03       ` [PATCHv2 0/2] " Michael J Gruber
@ 2009-03-16 17:03       ` Michael J Gruber
  2009-03-16 17:03       ` [PATCHv2 2/2] test-lib.sh: Allow running the test suite against installed git Michael J Gruber
  2 siblings, 0 replies; 7+ messages in thread
From: Michael J Gruber @ 2009-03-16 17:03 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

It just happens so that when GIT_EXEC_PATH points to a compiled checkout
of git.git it contains "git". Since this is not true in general make
test-lib check for "git-init" which is always in GIT_EXEC_PATH.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/test-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7a847ec..b9da86e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -454,7 +454,7 @@ test_create_repo () {
 	repo="$1"
 	mkdir -p "$repo"
 	cd "$repo" || error "Cannot setup test environment"
-	"$GIT_EXEC_PATH/git" init "--template=$owd/../templates/blt/" >&3 2>&4 ||
+	"$GIT_EXEC_PATH/git-init" "--template=$owd/../templates/blt/" >&3 2>&4 ||
 	error "cannot run git init -- have you built things yet?"
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
-- 
1.6.2.149.g6462

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv2 2/2] test-lib.sh: Allow running the test suite against installed git
  2009-03-14 20:25     ` Junio C Hamano
  2009-03-16 17:03       ` [PATCHv2 0/2] " Michael J Gruber
  2009-03-16 17:03       ` [PATCHv2 1/2] test-lib.sh: Test for presence of git-init in the right path Michael J Gruber
@ 2009-03-16 17:03       ` Michael J Gruber
  2 siblings, 0 replies; 7+ messages in thread
From: Michael J Gruber @ 2009-03-16 17:03 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Introduce variables GIT_TEST_INSTALLED and GIT_TEST_EXEC_PATH such that
the test suite can be run against a git which is installed at
GIT_TEST_INSTALLED with subcommands at GIT_TEST_EXEC_PATH.
GIT_TEST_INSTALLED defaults to the git.git checkout, GIT_TEST_EXEC_PATH
defaults to the output of '$GIT_TEST_INSTALLED/git --exec-path'. Run the
suite e.g. as

GIT_TEST_INSTALLED=/some/path make test

but note that this requires and uses parts of a compiled git in the
git.git checkout: test helpers, templates and perl libraries are taken
from there.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/test-lib.sh |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index b9da86e..c677904 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -514,8 +514,16 @@ test_done () {
 TEST_DIRECTORY=$(pwd)
 if test -z "$valgrind"
 then
-	PATH=$TEST_DIRECTORY/..:$PATH
-	GIT_EXEC_PATH=$TEST_DIRECTORY/..
+	if test -z "$GIT_TEST_INSTALLED"
+	then
+		PATH=$TEST_DIRECTORY/..:$PATH
+		GIT_EXEC_PATH=$TEST_DIRECTORY/..
+	else
+		GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path)  ||
+		error "Cannot run git from $GIT_TEST_INSTALLED."
+		PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
+		GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
+	fi
 else
 	make_symlink () {
 		test -h "$2" &&
-- 
1.6.2.149.g6462

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-16 17:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-13 15:45 [PATCH 0/2] Allow running the test suite against installed git Michael J Gruber
2009-03-13 15:45 ` [PATCH 1/2] test-lib.sh: Test for presence of git-init in the right path Michael J Gruber
2009-03-13 15:45   ` [PATCH 2/2] test-lib.sh: Allow running the test suite against installed git Michael J Gruber
2009-03-14 20:25     ` Junio C Hamano
2009-03-16 17:03       ` [PATCHv2 0/2] " Michael J Gruber
2009-03-16 17:03       ` [PATCHv2 1/2] test-lib.sh: Test for presence of git-init in the right path Michael J Gruber
2009-03-16 17:03       ` [PATCHv2 2/2] test-lib.sh: Allow running the test suite against installed git Michael J Gruber

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).