Patchwork [1,of,3] tests: check-code all python files in one run

login
register
mail settings
Submitter Simon Heimberg
Date June 12, 2013, 11:48 p.m.
Message ID <e15a377d7f040a8bf820.1371080903@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1727/
State Superseded, archived
Commit 96fd9af75834641ba3b8cd2e8583d604f269da3e
Headers show

Comments

Simon Heimberg - June 12, 2013, 11:48 p.m.
# HG changeset patch
# User simon@laptop-tosh
# Date 1371080641 -7200
# Node ID e15a377d7f040a8bf820362ed6f5343366b14f4e
# Parent  78c948ed59fd6c45ce10bfc67b213e8fcdb3b0cb
tests: check-code all python files in one run
Augie Fackler - June 14, 2013, 6:15 p.m.
On Thu, Jun 13, 2013 at 01:48:23AM +0200, Simon Heimberg wrote:
> # HG changeset patch
> # User simon@laptop-tosh
> # Date 1371080641 -7200
> # Node ID e15a377d7f040a8bf820362ed6f5343366b14f4e
> # Parent  78c948ed59fd6c45ce10bfc67b213e8fcdb3b0cb
> tests: check-code all python files in one run
>
> diff -r 78c948ed59fd -r e15a377d7f04 tests/test-check-code-hg.t
> --- a/tests/test-check-code-hg.t	Don Jun 13 01:44:01 2013 +0200
> +++ b/tests/test-check-code-hg.t	Don Jun 13 01:44:01 2013 +0200
> @@ -6,13 +6,7 @@
>    >     exit 80
>    > fi
>
> -New errors are not allowed. Warnings are strongly discouraged.
> -
> -  $ hg manifest 2>/dev/null \
> -  >   | xargs "$check_code" --warnings --nolineno --per-file=0 \
> -  >   || false
> -
> -Check Python files without py extension
> +Prepare check for Python files without py extension
>
>    $ cp \
>    >   hg \
> @@ -25,5 +19,9 @@
>    >   contrib/undumprevlog \
>    >   "$TESTTMP"/
>    $ for f in "$TESTTMP"/*; do cp "$f" "$f.py"; done
> -  $ "$check_code" --warnings --nolineno --per-file=0 "$TESTTMP"/*.py \
> -  >   || false
> +
> +New errors are not allowed. Warnings are strongly discouraged.
> +
> + $ hg manifest 2>/dev/null \
> + >   | xargs "$check_code" "$TESTTMP"/*.py --warnings --nolineno --per-file=0 \
> + >   || false

Couldn't this end up checking files from 'hg manifest' more than once
if the argv got too long for the platform? I have no idea if we're in
any danger of hitting that limit.

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - June 14, 2013, 6:54 p.m.
On Fri, 2013-06-14 at 14:15 -0400, Augie Fackler wrote:
> On Thu, Jun 13, 2013 at 01:48:23AM +0200, Simon Heimberg wrote:
> > # HG changeset patch
> > # User simon@laptop-tosh
> > # Date 1371080641 -7200
> > # Node ID e15a377d7f040a8bf820362ed6f5343366b14f4e
> > # Parent  78c948ed59fd6c45ce10bfc67b213e8fcdb3b0cb
> > tests: check-code all python files in one run
> >
> > diff -r 78c948ed59fd -r e15a377d7f04 tests/test-check-code-hg.t
> > --- a/tests/test-check-code-hg.t	Don Jun 13 01:44:01 2013 +0200
> > +++ b/tests/test-check-code-hg.t	Don Jun 13 01:44:01 2013 +0200
> > @@ -6,13 +6,7 @@
> >    >     exit 80
> >    > fi
> >
> > -New errors are not allowed. Warnings are strongly discouraged.
> > -
> > -  $ hg manifest 2>/dev/null \
> > -  >   | xargs "$check_code" --warnings --nolineno --per-file=0 \
> > -  >   || false
> > -
> > -Check Python files without py extension
> > +Prepare check for Python files without py extension
> >
> >    $ cp \
> >    >   hg \
> > @@ -25,5 +19,9 @@
> >    >   contrib/undumprevlog \
> >    >   "$TESTTMP"/
> >    $ for f in "$TESTTMP"/*; do cp "$f" "$f.py"; done
> > -  $ "$check_code" --warnings --nolineno --per-file=0 "$TESTTMP"/*.py \
> > -  >   || false
> > +
> > +New errors are not allowed. Warnings are strongly discouraged.
> > +
> > + $ hg manifest 2>/dev/null \
> > + >   | xargs "$check_code" "$TESTTMP"/*.py --warnings --nolineno --per-file=0 \
> > + >   || false
> 
> Couldn't this end up checking files from 'hg manifest' more than once
> if the argv got too long for the platform? I have no idea if we're in
> any danger of hitting that limit.

Not on Linux, which is now only bounded by ulimit. But might get into
trouble on AIX, Solaris, etc., which have much more finite limits.

Patch

diff -r 78c948ed59fd -r e15a377d7f04 tests/test-check-code-hg.t
--- a/tests/test-check-code-hg.t	Don Jun 13 01:44:01 2013 +0200
+++ b/tests/test-check-code-hg.t	Don Jun 13 01:44:01 2013 +0200
@@ -6,13 +6,7 @@ 
   >     exit 80
   > fi
 
-New errors are not allowed. Warnings are strongly discouraged.
-
-  $ hg manifest 2>/dev/null \
-  >   | xargs "$check_code" --warnings --nolineno --per-file=0 \
-  >   || false
-
-Check Python files without py extension
+Prepare check for Python files without py extension
 
   $ cp \
   >   hg \
@@ -25,5 +19,9 @@ 
   >   contrib/undumprevlog \
   >   "$TESTTMP"/
   $ for f in "$TESTTMP"/*; do cp "$f" "$f.py"; done
-  $ "$check_code" --warnings --nolineno --per-file=0 "$TESTTMP"/*.py \
-  >   || false
+
+New errors are not allowed. Warnings are strongly discouraged.
+
+ $ hg manifest 2>/dev/null \
+ >   | xargs "$check_code" "$TESTTMP"/*.py --warnings --nolineno --per-file=0 \
+ >   || false