git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Subject: [PATCH] t/test-lib: print pretty msg when git isn't built
Date: Mon, 17 Sep 2012 22:36:19 +0530	[thread overview]
Message-ID: <1347901579-5545-2-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1347901579-5545-1-git-send-email-artagnon@gmail.com>

When tests were run without building git, the following error message
was displayed:

    .: 54: Can't open /path/to/git/source/t/../GIT-BUILD-OPTIONS

Change this to display a more user-friendly error message:

     error: you do not seem to have built git yet.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 t/t0000-basic.sh |   10 ----------
 t/test-lib.sh    |    6 ++++++
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index ae6a3f0..08677df 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -18,16 +18,6 @@ swapping compression and hashing order, the person who is making the
 modification *should* take notice and update the test vectors here.
 '
 
-################################################################
-# It appears that people try to run tests without building...
-
-../git >/dev/null
-if test $? != 1
-then
-	echo >&2 'You do not seem to have built git yet.'
-	exit 1
-fi
-
 . ./test-lib.sh
 
 ################################################################
diff --git a/t/test-lib.sh b/t/test-lib.sh
index f8e3733..c00452a 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -51,6 +51,12 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
 
+if ! test -r "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
+then
+	echo 'error: you do not seem to have built git yet.' >&2
+	exit 1
+fi
+
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH
 
-- 
1.7.8.1.362.g5d6df.dirty

  reply	other threads:[~2012-09-17 17:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 17:06 [PATCH] t/perf: add "trash directory" to .gitignore Ramkumar Ramachandra
2012-09-17 17:06 ` Ramkumar Ramachandra [this message]
2012-09-17 20:53   ` [PATCH] t/test-lib: print pretty msg when git isn't built Junio C Hamano
2012-09-18  6:52     ` Ramkumar Ramachandra
2012-09-18  7:00       ` Junio C Hamano
2012-09-18  7:17         ` Ramkumar Ramachandra
2012-09-18  8:00           ` Junio C Hamano
2012-09-18  8:07             ` Ramkumar Ramachandra
2012-09-18 20:57               ` Junio C Hamano
2012-09-18 20:52   ` Junio C Hamano
2012-09-17 21:26 ` [PATCH] t/perf: add "trash directory" to .gitignore Junio C Hamano
2012-09-18  6:36   ` Ramkumar Ramachandra

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=1347901579-5545-2-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.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).