git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Sep 18, 2012, 06:52 UTC
Message-ID
<CALkWK0k9P9-K5R2Amipujq2DFvJTXy8T3ZyfFa31CcxeKSFL2g@mail.gmail.com>
In-Reply-To
<7v7grstlp9.fsf@alter.siamese.dyndns.org>
Hi Junio,
Junio C Hamano wrote:
> Is this a sufficient replacement for what you removed from 0000?
> Can the BUILD-OPTIONS file exist when your build of git failed?

Oops, I didn't realize that BUILD-OPTIONS would be written when the build fails. How about something like this instead:

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

 ################################################################
	Modified   t/test-lib.sh
diff --git a/t/test-lib.sh b/t/test-lib.sh
index f8e3733..8cc7755 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -51,6 +51,12 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..

+if ! test -x "$GIT_BUILD_DIR"/git || "$GIT_BUILD_DIR"/git && test $? != 1
+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
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 12 in “t/perf: add "trash directory" to .gitignore”
  1. t/perf: add "trash directory" to .gitignoreRamkumar Ramachandra, Sep 17, 2012
  2. t/test-lib: print pretty msg when git isn't builtRamkumar Ramachandra, Sep 17, 2012
  3. Junio C HamanoSep 17, 2012
  4. Ramkumar RamachandraSep 18, 2012
  5. Junio C HamanoSep 18, 2012
  6. Ramkumar RamachandraSep 18, 2012
  7. Junio C HamanoSep 18, 2012
  8. Ramkumar RamachandraSep 18, 2012
  9. Junio C HamanoSep 18, 2012
  10. Junio C HamanoSep 18, 2012
  11. Junio C HamanoSep 17, 2012
  12. Ramkumar RamachandraSep 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.