[PATCH 2 of 2] tests: add new test for #! shbang lines

Yuya Nishihara yuya at tcha.org
Sat Apr 16 01:56:11 EDT 2016


On Fri, 15 Apr 2016 22:19:51 -0400, Matt Harbison wrote:
> On Wed, 06 Apr 2016 21:26:37 -0400, timeless <timeless at mozdev.org> wrote:
> > # HG changeset patch
> > # User timeless <timeless at mozdev.org>
> > # Date 1459969752 0
> > #      Wed Apr 06 19:09:12 2016 +0000
> > # Node ID 16e6523533e263430f06ffd785c921a114268199
> > # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
> > tests: add new test for #! shbang lines
> >
> > * use #!/bin/sh not e.g. #!/usr/bin/sh
> > * use #!/usr/bin/env python not e.g. #!/usr/bin/python
> >
> > diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
> > copy from tests/test-check-execute.t
> > copy to tests/test-check-shbang.t
> > --- a/tests/test-check-execute.t
> > +++ b/tests/test-check-shbang.t
> > @@ -1,23 +1,13 @@
> > -#require test-repo execbit
> > +#require test-repo
> >   $ cd "`dirname "$TESTDIR"`"
> > -look for python scripts without the execute bit
> > +look for python scripts that do not use /usr/bin/env
> > -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
> > +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env  
> > python")'
> >    [1]
> > -look for python scripts with execute bit but not shebang
> > +look for shell scripts that do not use /bin/sh
> > -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
> > +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
> >    [1]  
> 
> Is there a way to lose these lines other than `grep -v`?
> 
>     $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
> +  obsolete feature not enabled but 110079 markers found!
>     [1]

2>/dev/null ?

> (I'm a bit surprised nobody else is seeing this?)

I've never seen it without "run-tests.py -l", and it isn't always displayed
even with "-l".


More information about the Mercurial-devel mailing list