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

[PATCH v2] test-lib: try harder to ensure a working jgit

From
Todd Zullinger <tmz@pobox.com>
Date
May 15, 2019, 01:36 UTC
Message-ID
<20190515013633.GQ3654@pobox.com>
In-Reply-To
<20190514020520.GI3654@pobox.com>

The JGIT prereq uses `type jgit` to determine whether jgit is present. While this is usually sufficient, it won't help if the jgit found is badly broken. This wastes time running tests which fail due to no fault of our own.

Use `jgit --version` instead, to guard against cases where jgit is present on the system, but will fail to run, e.g. because of some JRE issue, or missing Java dependencies. Checking that it gets far enough to process the '--version' argument isn't perfect, but seems to be good enough in practice. It's also consistent with how we detect some other dependencies, see e.g. the CURL and UNZIP prerequisites.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
As promised, I stole the second paragraph from Ævar nearly verbatim. :)
 t/test-lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 908ddb9c46..599fd70e14 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1522,7 +1522,7 @@ test_lazy_prereq NOT_ROOT '
 '
 
 test_lazy_prereq JGIT '
-	type jgit
+	jgit --version
 '
 
 # SANITY is about "can you correctly predict what the filesystem would
-- 
Todd
Previous: Junio C Hamano
Message 11 of 11 in “test-lib: try harder to ensure a working jgit”
  1. test-lib: try harder to ensure a working jgitTodd Zullinger, May 14, 2019
  2. brian m. carlsonMay 14, 2019
  3. Jeff KingMay 14, 2019
  4. Junio C HamanoMay 15, 2019
  5. Todd ZullingerMay 15, 2019
  6. brian m. carlsonMay 15, 2019
  7. Jonathan NiederMay 14, 2019
  8. Ævar Arnfjörð BjarmasonMay 14, 2019
  9. Todd ZullingerMay 15, 2019
  10. Junio C HamanoMay 15, 2019
  11. test-lib: try harder to ensure a working jgitTodd Zullinger, May 15, 2019

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.