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
Junio C Hamano <gitster@pobox.com>
Date
Sep 18, 2012, 20:57 UTC
Message-ID
<7v627bkq0h.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0=JY3pTyyMAmFVnQatn6gd3eC7dxiBbTh0WmVwkdLTbHQ@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 16 quoted lines
>>> Because that emits an ugly
>>> ./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found
>>
>> Don't you deserve it? ;-)
>>
>> The full message would read
>>
>>     ./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found
>>     error: you do not seem to have built git yet.
>>
>> which looks perfectly sensible to me.  It makes it clear where on
>> the filesystem the test script expects your "git", which is an added
>> benefit.
>
> Fair enough- use your version then.  Let me know if you want me to
> submit a revised patch.
OK, let's do this.
-- >8 --
From: Ramkumar Ramachandra <artagnon@gmail.com>
Date: Mon, 17 Sep 2012 22:36:19 +0530
Subject: [PATCH] t/test-lib: print pretty msg when git isn't built
When tests were run without building git, they stopped with:
    .: 54: Can't open /path/to/git/source/t/../GIT-BUILD-OPTIONS

Move the check that makes sure that git has already been built from t0000 to test-lib, so that any test will do so before it runs.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t0000-basic.sh | 10 ----------
 t/test-lib.sh    |  7 +++++++
 2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index ccb5435..741b6b6 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 78c4286..61930fb 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -51,6 +51,13 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
 
+"$GIT_BUILD_DIR/git" >/dev/null
+if test $? != 1
+then
+	echo >&2 'error: you do not seem to have built git yet.'
+	exit 1
+fi
+
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH
 
-- 
1.7.12.563.g54818e4
Previous: Ramkumar RamachandraNext: Junio C Hamano
Message 9 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.