{"thread":{"id":"33362","subject":"[PATCH] test-lint-duplicates: Only check for numbered test cases","startedAt":"2013-04-03T05:54:02Z","lastAt":"2013-04-10T16:00:37Z","messageCount":4,"participants":["Torsten Bögershausen","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"213023","messageId":"201304030754.03100.tboegi@web.de","threadId":"33362","inReplyTo":null,"subject":"[PATCH] test-lint-duplicates: Only check for numbered test cases","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-04-03T05:54:02Z","receivedAt":"2013-04-03T05:54:02Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"Running make inside contrib/remote-helpers fails in \"test-lint-duplicates\"\n\nThis was because the regexp checking for duplicate numbers strips everything\nafter the first \"-\" in the filename, including the prefix.\n\nAs a result, 2 pathnames like\n\"xxxx/contrib/remote-helpers/test-bzr.sh\" and\n\"xxxx/contrib/remote-helpers/test-hg-bidi.sh\"\n\nare both converted into\n\"xxxx/contrib/remote\", and reported as duplicate.\n\nImprove the regexp:\nRemove everything after tNNNN- (where X stand for a digit)\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n t/Makefile | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/Makefile b/t/Makefile\nindex 1923cc1..f123d02 100644\n--- a/t/Makefile\n+++ b/t/Makefile\n@@ -48,7 +48,7 @@ clean: clean-except-prove-cache\n test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax\n \n test-lint-duplicates:\n-\t@dups=`echo $(T) | tr ' ' '\\n' | sed 's/-.*//' | sort | uniq -d` && \\\n+\t@dups=`echo $(T) | tr ' ' '\\n' | sed -ne 's|\\(.*/\\)*t\\([0-9][0-9][0-9][0-9]\\)-.*|\\2|p' | sort | uniq -d` && \\\n \t\ttest -z \"$$dups\" || { \\\n \t\techo >&2 \"duplicate test numbers:\" $$dups; exit 1; }\n \n-- \n1.8.2.411.g65a544e\n"},{"id":"213035","messageId":"20130403142804.GB10494@sigill.intra.peff.net","threadId":"33362","inReplyTo":"201304030754.03100.tboegi@web.de","subject":"Re: [PATCH] test-lint-duplicates: Only check for numbered test cases","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-04-03T14:28:04Z","receivedAt":"2013-04-03T14:28:04Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 03, 2013 at 07:54:02AM +0200, Torsten Bögershausen wrote:\n\n> Running make inside contrib/remote-helpers fails in \"test-lint-duplicates\"\n> \n> This was because the regexp checking for duplicate numbers strips everything\n> after the first \"-\" in the filename, including the prefix.\n> \n> As a result, 2 pathnames like\n> \"xxxx/contrib/remote-helpers/test-bzr.sh\" and\n> \"xxxx/contrib/remote-helpers/test-hg-bidi.sh\"\n> \n> are both converted into\n> \"xxxx/contrib/remote\", and reported as duplicate.\n> \n> Improve the regexp:\n> Remove everything after tNNNN- (where X stand for a digit)\n\nI think the approach to just make test-lint-duplicates a no-op on\nnon-numbered tests is reasonable, but this is side-stepping half of the\nissue. The problems are:\n\n  1. We do not have numbers in our test names.\n\n  2. We _do_ have full paths in the test names, which might have\n     elements which look like test script names.\n\nYour patch tightens the match so that a hyphen in the path name does not\nconfuse our script. But it trades it for being confused by tNNNN in the\npathname. Which is admittedly less likely, but is not addressing the\nfundamental issues that we should only be processing basenames.\n\nSo something like \"sed 's,.*/,,'\" would fix that. But that still leaves\nus with a bunch of tests called \"test-foo\", \"test-bar\", etc, which will\nappear as duplicates. So we would still want to tighten the number\nparsing.\n\nLike:\n\ndiff --git a/t/Makefile b/t/Makefile\nindex 5c6de81..e5afa4c 100644\n--- a/t/Makefile\n+++ b/t/Makefile\n@@ -47,7 +47,9 @@ test-lint-duplicates:\n test-lint: test-lint-duplicates test-lint-executable\n \n test-lint-duplicates:\n-\t@dups=`echo $(T) | tr ' ' '\\n' | sed 's/-.*//' | sort | uniq -d` && \\\n+\t@dups=`echo $(T) | tr ' ' '\\n' | \\\n+\t\tsed -e 's,.*/,,' -e 's/\\(t[0-9][0-9][0-9][0-9]\\)-.*/\\1/' | \\\n+\t\tsort | uniq -d` && \\\n \t\ttest -z \"$$dups\" || { \\\n \t\techo >&2 \"duplicate test numbers:\" $$dups; exit 1; }\n \n\n-Peff\n"},{"id":"213774","messageId":"516573CA.2000804@web.de","threadId":"33362","inReplyTo":"20130403142804.GB10494@sigill.intra.peff.net","subject":"Re: [PATCH] test-lint-duplicates: Only check for numbered test cases","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-04-10T14:14:34Z","receivedAt":"2013-04-10T14:14:34Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 03.04.13 16:28, Jeff King wrote:\n> On Wed, Apr 03, 2013 at 07:54:02AM +0200, Torsten Bögershausen wrote:\n> \n>> Running make inside contrib/remote-helpers fails in \"test-lint-duplicates\"\n>>\n>> This was because the regexp checking for duplicate numbers strips everything\n>> after the first \"-\" in the filename, including the prefix.\n>>\n>> As a result, 2 pathnames like\n>> \"xxxx/contrib/remote-helpers/test-bzr.sh\" and\n>> \"xxxx/contrib/remote-helpers/test-hg-bidi.sh\"\n>>\n>> are both converted into\n>> \"xxxx/contrib/remote\", and reported as duplicate.\n>>\n>> Improve the regexp:\n>> Remove everything after tNNNN- (where X stand for a digit)\n> \n> I think the approach to just make test-lint-duplicates a no-op on\n> non-numbered tests is reasonable, but this is side-stepping half of the\n> issue. The problems are:\n> \n>   1. We do not have numbers in our test names.\n> \n>   2. We _do_ have full paths in the test names, which might have\n>      elements which look like test script names.\n> \n> Your patch tightens the match so that a hyphen in the path name does not\n> confuse our script. But it trades it for being confused by tNNNN in the\n> pathname. Which is admittedly less likely, but is not addressing the\n> fundamental issues that we should only be processing basenames.\n> \n> So something like \"sed 's,.*/,,'\" would fix that. But that still leaves\n> us with a bunch of tests called \"test-foo\", \"test-bar\", etc, which will\n> appear as duplicates. So we would still want to tighten the number\n> parsing.\n> \n> Like:\n> \n> diff --git a/t/Makefile b/t/Makefile\n> index 5c6de81..e5afa4c 100644\n> --- a/t/Makefile\n> +++ b/t/Makefile\n> @@ -47,7 +47,9 @@ test-lint-duplicates:\n>  test-lint: test-lint-duplicates test-lint-executable\n>  \n>  test-lint-duplicates:\n> -\t@dups=`echo $(T) | tr ' ' '\\n' | sed 's/-.*//' | sort | uniq -d` && \\\n> +\t@dups=`echo $(T) | tr ' ' '\\n' | \\\n> +\t\tsed -e 's,.*/,,' -e 's/\\(t[0-9][0-9][0-9][0-9]\\)-.*/\\1/' | \\\n> +\t\tsort | uniq -d` && \\\n>  \t\ttest -z \"$$dups\" || { \\\n>  \t\techo >&2 \"duplicate test numbers:\" $$dups; exit 1; }\n>  \n> \n> -Peff\nI thinkg we need both the striping of the path and the \"grepping\" for\nnumbered test cases only.\nI'll send a patch in a minute\n"},{"id":"213781","messageId":"20130410160037.GB10749@sigill.intra.peff.net","threadId":"33362","inReplyTo":"516573CA.2000804@web.de","subject":"Re: [PATCH] test-lint-duplicates: Only check for numbered test cases","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-04-10T16:00:37Z","receivedAt":"2013-04-10T16:00:37Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 10, 2013 at 04:14:34PM +0200, Torsten Bögershausen wrote:\n\n> >  test-lint-duplicates:\n> > -\t@dups=`echo $(T) | tr ' ' '\\n' | sed 's/-.*//' | sort | uniq -d` && \\\n> > +\t@dups=`echo $(T) | tr ' ' '\\n' | \\\n> > +\t\tsed -e 's,.*/,,' -e 's/\\(t[0-9][0-9][0-9][0-9]\\)-.*/\\1/' | \\\n> > +\t\tsort | uniq -d` && \\\n> >  \t\ttest -z \"$$dups\" || { \\\n> >  \t\techo >&2 \"duplicate test numbers:\" $$dups; exit 1; }\n> >  \n> > \n> > -Peff\n> I thinkg we need both the striping of the path and the \"grepping\" for\n> numbered test cases only.\n> I'll send a patch in a minute\n\nI think it is fine either way. My command above turns:\n\n  /path/to/test-one.sh\n  /path/to/test-two.sh\n\ninto\n\n  test-one.sh\n  test-two.sh\n\nwhich is fine for running through uniq. If you use \"sed -n\", you simply\nend up with an empty list, which is also fine.\n\n-Peff\n"}]}