Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:47

Possibly related (same subject, not in this thread)

Ramkumar Ramachandra [off-list ref] writes:
quoted hunk
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 <redacted>
---
 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
+
Is this a sufficient replacement for what you removed from 0000?
Can the BUILD-OPTIONS file exist when your build of git failed?
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help