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

[PATCH v2] test suite: add a check that all test numbers are unique

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Aug 21, 2009, 13:13 UTC
Message-ID
<4A8E9D73.1090604@viscovery.net>
In-Reply-To
<20090821125324.GA6280@coredump.intra.peff.net>
Jeff King schrieb:
Show 8 quoted lines
> Why not the much shorter:
> 
> tests() {
>   ls | sed -n 's/^\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$/\1/p'
> }
> dups=`tests | uniq -d`
> 
> instead of the long shell loop?

Because it's faster on Windows ;-) No, seriously, I didn't know about uniq -d.

Here is a replacement patch.
--- 8< ---
From: Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] t/Makefile: add a check that all test numbers are unique

The test runs only if 'make all' is used. Its purpose is to alert our valued integrator if different branches are merged that happen to introduce the same test number.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 t/Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/t/Makefile b/t/Makefile
index bd09390..ed8281a 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -17,6 +17,10 @@ T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
 TSVN = $(wildcard t91[0-9][0-9]-*.sh)

 all: pre-clean
+	@dups=`ls | sed -n 's/^\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$$/\1/p' | \
+			uniq -d` && \
+		test -z "$$dups" || { \
+		echo "duplicate test numbers:" $$dups; exit 1; }
 	$(MAKE) aggregate-results-and-cleanup

 $(T):
-- 
1.6.4.204.g6aad7
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “test suite: add a check that all test numbers are unique”
  1. test suite: add a check that all test numbers are uniqueJohannes Sixt, Aug 21, 2009
  2. Jeff KingAug 21, 2009
  3. test suite: add a check that all test numbers are uniqueJohannes Sixt, Aug 21, 2009
  4. Jeff KingAug 21, 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.