Skip to contentSkip to conversation

test-lint-duplicates: check numbering in contrib/remote-helpers

PATCH In review Torsten Bögershausen 4 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test-lint-duplicates: check numbering in contrib/remote-helpers

Running make inside contrib/remote-helpers failes in "test-lint-duplicates"

This was because the regexp to check 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-bzr.sh" and
"xxxx/contrib/remote-helpers/test-hg-bidi.sh"

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

Improve the regexp:
Remove everything after tNNNN- (where X stand for a digit)

Rename the tests in contrib/remote-helpers into
t5810-test-bzr.sh,
t5820-test-hg-bidi.sh,
t5821-test-hg-hg-git.sh,
t5830-test-hg.sh

Feed the numbers used in contrib/remote-helpers into t/Makefile and check that numbering is unique across both directories

---
 contrib/remote-helpers/Makefile                |   3 +-
 contrib/remote-helpers/t5810-test-bzr.sh       | 143 +++++++
 contrib/remote-helpers/t5820-test-hg-bidi.sh   | 243 +++++++++++
 contrib/remote-helpers/t5821-test-hg-hg-git.sh | 534 +++++++++++++++++++++++++
 contrib/remote-helpers/t5830-test-hg.sh        | 121 ++++++
 contrib/remote-helpers/test-bzr.sh             | 143 -------
 contrib/remote-helpers/test-hg-bidi.sh         | 243 -----------
 contrib/remote-helpers/test-hg-hg-git.sh       | 534 -------------------------
 contrib/remote-helpers/test-hg.sh              | 121 ------
 t/Makefile                                     |   2 +-
 10 files changed, 1044 insertions(+), 1043 deletions(-)
 create mode 100755 contrib/remote-helpers/t5810-test-bzr.sh
 create mode 100755 contrib/remote-helpers/t5820-test-hg-bidi.sh
 create mode 100755 contrib/remote-helpers/t5821-test-hg-hg-git.sh
 create mode 100755 contrib/remote-helpers/t5830-test-hg.sh
 delete mode 100755 contrib/remote-helpers/test-bzr.sh
 delete mode 100755 contrib/remote-helpers/test-hg-bidi.sh
 delete mode 100755 contrib/remote-helpers/test-hg-hg-git.sh
 delete mode 100755 contrib/remote-helpers/test-hg.sh
contrib/remote-helpers/Makefile +2 -1
index 9a76575..012ad50 100644
@@ -1,6 +1,7 @@
-TESTS := $(wildcard test*.sh)
+TESTS := $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
 
 export T := $(addprefix $(CURDIR)/,$(TESTS))
+export TDUP := $(sort $(wildcard ../../t/t[0-9][0-9][0-9][0-9]-*.sh))
 export MAKE := $(MAKE) -e
 export PATH := $(CURDIR):$(PATH)
 
contrib/remote-helpers/t5810-test-bzr.sh new file +143 -0

143 lines not on this page · raw message

contrib/remote-helpers/t5820-test-hg-bidi.sh new file +243 -0

243 lines not on this page · raw message

contrib/remote-helpers/t5821-test-hg-hg-git.sh new file +534 -0

534 lines not on this page · raw message

contrib/remote-helpers/t5830-test-hg.sh new file +121 -0

121 lines not on this page · raw message

contrib/remote-helpers/test-bzr.sh deleted +0 -143

143 lines not on this page · raw message

contrib/remote-helpers/test-hg-bidi.sh deleted +0 -243

243 lines not on this page · raw message

contrib/remote-helpers/test-hg-hg-git.sh deleted +0 -534

534 lines not on this page · raw message

contrib/remote-helpers/test-hg.sh deleted +0 -121

121 lines not on this page · raw message

t/Makefile +1 -1
index 1923cc1..612fe79 100644
@@ -48,7 +48,7 @@ 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) $(TDUP) | tr ' ' '\n' | sed -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; }
 
Signature · 1 line
1.8.2.341.g543621f
#1 lore raw
Quoted 12 lines · Torsten Bögershausen
---
 contrib/remote-helpers/Makefile                |   3 +-
 contrib/remote-helpers/t5810-test-bzr.sh       | 143 +++++++
 contrib/remote-helpers/t5820-test-hg-bidi.sh   | 243 +++++++++++
 contrib/remote-helpers/t5821-test-hg-hg-git.sh | 534 +++++++++++++++++++++++++
 contrib/remote-helpers/t5830-test-hg.sh        | 121 ++++++
 contrib/remote-helpers/test-bzr.sh             | 143 -------
 contrib/remote-helpers/test-hg-bidi.sh         | 243 -----------
 contrib/remote-helpers/test-hg-hg-git.sh       | 534 -------------------------
 contrib/remote-helpers/test-hg.sh              | 121 ------
 t/Makefile                                     |   2 +-
 10 files changed, 1044 insertions(+), 1043 deletions(-)
Quoted 8 lines
 create mode 100755 contrib/remote-helpers/t5810-test-bzr.sh
 create mode 100755 contrib/remote-helpers/t5820-test-hg-bidi.sh
 create mode 100755 contrib/remote-helpers/t5821-test-hg-hg-git.sh
 create mode 100755 contrib/remote-helpers/t5830-test-hg.sh
 delete mode 100755 contrib/remote-helpers/test-bzr.sh
 delete mode 100755 contrib/remote-helpers/test-hg-bidi.sh
 delete mode 100755 contrib/remote-helpers/test-hg-hg-git.sh
 delete mode 100755 contrib/remote-helpers/test-hg.sh

Don't hesitate to format patches with -M :)

#2 lore raw
In reply to Torsten Bögershausen
Quoted 8 lines · Torsten Bögershausen

Rename the tests in contrib/remote-helpers into
t5810-test-bzr.sh,
t5820-test-hg-bidi.sh,
t5821-test-hg-hg-git.sh,
t5830-test-hg.sh

Feed the numbers used in contrib/remote-helpers into t/Makefile and check that numbering is unique across both directories

TBH I don't see the point of this; we don't *need* to run test-lint-duplicates here, the system should adapt to the situation, and it already does, no need to add four digit numbers just so we can run test-lint-duplicates.

Signature · 1 line
Felipe Contreras
#3 lore raw
In reply to Torsten Bögershausen
Quoted 1 line · Torsten Bögershausen

Running make inside contrib/remote-helpers failes in "test-lint-duplicates"

s/failes/fails/

Quoted 21 lines

This was because the regexp to check 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-bzr.sh" and
"xxxx/contrib/remote-helpers/test-hg-bidi.sh"

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

Improve the regexp:
Remove everything after tNNNN- (where X stand for a digit)

Rename the tests in contrib/remote-helpers into
t5810-test-bzr.sh,
t5820-test-hg-bidi.sh,
t5821-test-hg-hg-git.sh,
t5830-test-hg.sh

Feed the numbers used in contrib/remote-helpers into t/Makefile and check that numbering is unique across both directories