threads / patch / 33458

patchtest-lint-duplicates: consider only numbered test cases

Subject: [PATCH] test-lint-duplicates: consider only numbered test cases

## tl;dr

2 messages between Apr 10, 2013 and Apr 10, 2013. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Torsten Bögershausen· Apr 10, 2013, 14:22 UTC · lore
Running make inside contrib/remote-helpers may fail in "test-lint-duplicates"

This was because the regexp checking for duplicate numbers strips everything after the first "-" in the filename, including the prefix.

As a result, 2 pathnames like "xxxx/contrib/remote-helpers/test-XX.sh" and "xxxx/contrib/remote-helpers/test-YY.sh"

are both converted into "xxxx/contrib/remote", and reported as duplicate.

Improve the regexp:
- strip the leading path and look only at the basename
- only look at files which have tNNNN- (where N stand for a digit) in the name
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
http://comments.gmane.org/gmane.comp.version-control.git/214194
 t/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Show changes to t/Makefile +3 −1
diff --git a/t/Makefile b/t/Makefile
index 1923cc1..cfd6d5a 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -48,7 +48,9 @@ clean: clean-except-prove-cache
 test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
 
 test-lint-duplicates:
-	@dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
+	@dups=`echo $(T) | tr ' ' '\n' | \
+		sed -e 's,.*/,,' -ne 's|\(.*/\)*t\([0-9][0-9][0-9][0-9]\)-.*|\2|p' | \
+		sort | uniq -d` && \
 		test -z "$$dups" || { \
 		echo >&2 "duplicate test numbers:" $$dups; exit 1; }
 
-- 
1.8.2.282.g4bc7171
Jeff King· Apr 10, 2013, 16:03 UTC · re: Torsten Bögershausen · lore

Re: [PATCH] test-lint-duplicates: consider only numbered test cases

On Wed, Apr 10, 2013 at 04:22:57PM +0200, Torsten Bögershausen wrote:
Show 18 quoted lines
> Running make inside contrib/remote-helpers may fail in "test-lint-duplicates"
> 
> This was because the regexp checking for duplicate numbers strips everything
> after the first "-" in the filename, including the prefix.
> 
> As a result, 2 pathnames like
> "xxxx/contrib/remote-helpers/test-XX.sh" and
> "xxxx/contrib/remote-helpers/test-YY.sh"
> 
> are both converted into
> "xxxx/contrib/remote", and reported as duplicate.
> 
> Improve the regexp:
> - strip the leading path and look only at the basename
> - only look at files which have tNNNN- (where N stand for a digit) in the name
> 
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---

Yeah, I think this is fine. Though note that we already have Felipe's patch to just set TEST_LINT explicitly, so I think it is a non-issue now.

-Peff

← back to recent threads