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

[PATCH master] t/test-lib.sh: provide a shell implementation of the 'yes' utility

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Aug 28, 2009, 22:32 UTC
Message-ID
<hFaZixUUvhrEV7wTTph3baQERVcA7g0KV0MihRGD1StE5zN58p2u1kJ9hdFMxNeyvn0_E3JvnFM@cipher.nrlssc.navy.mil>
In-Reply-To
<tK_IWVRokJuwYhAJ3h5cvYFUGHzmrYoRPbMxLQUdj2eLINK_28NnVA@cipher.nrlssc.navy.mil>
From: Brandon Casey <drafnel@gmail.com>

Some platforms (IRIX 6.5, Solaris 7) do not provide the 'yes' utility. Currently, some tests, including t7610 and t9001, try to call this program. Due to the way the tests are structured, the tests still pass even though this program is missing. Rather than succeeding by chance, let's provide an implementation of the simple 'yes' utility in shell for all platforms to use.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 t/test-lib.sh |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a5b8d03..f2ca536 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -685,6 +685,21 @@ do
 	esac
 done
 
+# Provide an implementation of the 'yes' utility
+yes () {
+	if test $# = 0
+	then
+		y=y
+	else
+		y="$*"
+	fi
+
+	while echo "$y"
+	do
+		:
+	done
+}
+
 # Fix some commands on Windows
 case $(uname -s) in
 *MINGW*)
-- 
1.6.4
Previous: Brandon CaseyNext: Daniel Barkalow
Message 9 of 15 in “What's cooking in git.git (Aug 2009, #05; Wed, 26)”
  1. Junio C HamanoAug 26, 2009
  2. Shawn O. PearceAug 26, 2009
  3. Sverre RabbelierAug 27, 2009
  4. Shawn O. PearceAug 27, 2009
  5. Sverre RabbelierAug 27, 2009
  6. Brandon CaseyAug 27, 2009
  7. Junio C HamanoAug 27, 2009
  8. Brandon CaseyAug 27, 2009
  9. t/test-lib.sh: provide a shell implementation of the 'yes' utilityBrandon Casey, Aug 28, 2009
  10. Daniel BarkalowAug 30, 2009
  11. Junio C HamanoAug 30, 2009
  12. Junio C HamanoAug 30, 2009
  13. Daniel BarkalowAug 31, 2009
  14. Junio C HamanoAug 31, 2009
  15. Daniel BarkalowSep 1, 2009

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.