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

[PATCH] t7063: hide stderr from setup inside prereq

From
Jeff King <peff@peff.net>
Date
May 27, 2015, 09:34 UTC
Message-ID
<20150527093457.GA2826@peff.net>

When t7063 starts, it runs "update-index --untracked-cache" to see if we support the untracked cache. Its output goes straight to stderr, even if the test is not run with "-v". Let's wrap it in a prereq that will hide the output by default, but show it with "-v".

Signed-off-by: Jeff King <peff@peff.net>
---
I noticed this messing up my "prove" output. And it always runs first
with "prove --state=slow", because it has a whopping 17 seconds of
sleeps in it.
 t/t7063-status-untracked-cache.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh
index 2b2ffd7..bd4806c 100755
--- a/t/t7063-status-untracked-cache.sh
+++ b/t/t7063-status-untracked-cache.sh
@@ -8,10 +8,14 @@ avoid_racy() {
 	sleep 1
 }
 
-git update-index --untracked-cache
 # It's fine if git update-index returns an error code other than one,
 # it'll be caught in the first test.
-if test $? -eq 1; then
+test_lazy_prereq UNTRACKED_CACHE '
+	{ git update-index --untracked-cache; ret=$?; } &&
+	test $ret -ne 1
+'
+
+if ! test_have_prereq UNTRACKED_CACHE; then
 	skip_all='This system does not support untracked cache'
 	test_done
 fi
-- 
2.4.1.552.g6de66a4
Message 1 of 1 in “t7063: hide stderr from setup inside prereq”
  1. t7063: hide stderr from setup inside prereqJeff King, May 27, 2015

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.