From: Thomas Rast <trast@student.ethz.ch>
To: <git@vger.kernel.org>
Cc: Michael Haggerty <mhagger@alum.mit.edu>
Subject: [RFC PATCH 2/4] test-lib: allow testing another git build tree
Date: Wed, 14 Dec 2011 16:23:30 +0100 [thread overview]
Message-ID: <94f64a03398829bb9a11c18577efb39d9b153eca.1323876121.git.trast@student.ethz.ch> (raw)
In-Reply-To: <cover.1323876121.git.trast@student.ethz.ch>
The perf-lib work wants this feature, so we may as well do it for
test-lib in general. You can now say
GIT_BUILD_DIR=/another/git/tree
make test # or any other test
and it will run the tests of the current tree against the binaries of
the other tree.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Makefile | 7 ++++++-
t/test-lib.sh | 19 ++++++++++++++++---
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 2127c1b..52506bf 100644
--- a/Makefile
+++ b/Makefile
@@ -2215,6 +2215,12 @@ GIT-BUILD-OPTIONS: FORCE
@echo USE_LIBPCRE=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE)))'\' >>$@
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
+ @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@
+
+GIT-TEST-OPTIONS: FORCE
+ifdef GIT_TEST_OPTS
+ @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >$@
+endif
ifdef GIT_TEST_CMP
@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@
endif
@@ -2222,7 +2228,6 @@ ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
endif
@echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@
### Detect Tck/Tk interpreter path changes
ifndef NO_TCLTK
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 368e48c..06f8c96 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -54,6 +54,7 @@ unset $(perl -e '
.*_TEST
PROVE
VALGRIND
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
@@ -318,7 +319,7 @@ test_done () {
GIT_EXIT_OK=t
if test -z "$HARNESS_ACTIVE"; then
- test_results_dir="$TEST_DIRECTORY/test-results"
+ test_results_dir="$TEST_OUTPUT_DIRECTORY/test-results"
mkdir -p "$test_results_dir"
test_results_path="$test_results_dir/${0%.sh}-$$.counts"
@@ -379,7 +380,18 @@ then
# itself.
TEST_DIRECTORY=$(pwd)
fi
-GIT_BUILD_DIR="$TEST_DIRECTORY"/..
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+if test -z "$GIT_BUILD_DIR"
+then
+ # Similarly, override this to test a different git build tree
+ # than the one you are running the tests from
+ GIT_BUILD_DIR="$TEST_DIRECTORY"/..
+fi
if test -n "$valgrind"
then
@@ -477,6 +489,7 @@ GIT_ATTR_NOSYSTEM=1
export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
+. "$TEST_DIRECTORY"/../GIT-TEST-OPTIONS
if test -z "$GIT_TEST_CMP"
then
@@ -514,7 +527,7 @@ test="trash directory.$(basename "$0" .sh)"
test -n "$root" && test="$root/$test"
case "$test" in
/*) TRASH_DIRECTORY="$test" ;;
- *) TRASH_DIRECTORY="$TEST_DIRECTORY/$test" ;;
+ *) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$test" ;;
esac
test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY
rm -fr "$test" || {
--
1.7.8.304.ge42e4
next prev parent reply other threads:[~2011-12-14 15:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 15:23 [RFC PATCH 0/4] Performance test framework Thomas Rast
2011-12-14 15:23 ` [RFC PATCH 1/4] Move the user-facing test library to test-lib-functions.sh Thomas Rast
2011-12-14 15:23 ` Thomas Rast [this message]
2011-12-15 3:07 ` [RFC PATCH 2/4] test-lib: allow testing another git build tree Junio C Hamano
2011-12-15 10:33 ` Thomas Rast
2011-12-15 19:05 ` Junio C Hamano
2011-12-14 15:23 ` [RFC PATCH 3/4] Introduce a performance testing framework Thomas Rast
2011-12-14 16:04 ` Thomas Rast
2011-12-14 15:23 ` [RFC PATCH 4/4] Add a performance test for git-grep Thomas Rast
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=94f64a03398829bb9a11c18577efb39d9b153eca.1323876121.git.trast@student.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
/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).