Submitter | Danek Duvall |
---|---|
Date | Aug. 26, 2013, 5:28 p.m. |
Message ID | <7d2fe0113e5c21bc2046.1377538116@smelly> |
Download | mbox | patch |
Permalink | /patch/2267/ |
State | Superseded |
Delegated to: | Augie Fackler |
Headers | show |
Comments
On Mon, Aug 26, 2013 at 10:28:36AM -0700, Danek Duvall wrote: > # HG changeset patch > # User Danek Duvall <danek.duvall@oracle.com> > # Date 1377297397 25200 > # Node ID 7d2fe0113e5c21bc204616649256d1bb59d7d7f5 > # Parent bd488d5b5763ef8c4bc7b4a69e4073861e2487a1 > solaris: tests can't use tail -n Afraid we'll have to come up with another solution for this: + tail: cannot open `+8' for reading: No such file or directory > > Solaris tail doesn't recognize the -n option. Remove the one use of it and > add a test case to check-code.py. > > diff --git a/contrib/check-code.py b/contrib/check-code.py > --- a/contrib/check-code.py > +++ b/contrib/check-code.py > @@ -68,6 +68,7 @@ testpats = [ > (r'echo -n', "don't use 'echo -n', use printf"), > (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"), > (r'head -c', "don't use 'head -c', use 'dd'"), > + (r'tail -n', "don't use the '-n' option to tail, just use '-<num>'"), > (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"), > (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"), > (r'printf.*[^\\]\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"), > diff --git a/tests/test-import-merge.t b/tests/test-import-merge.t > --- a/tests/test-import-merge.t > +++ b/tests/test-import-merge.t > @@ -129,7 +129,7 @@ Test that --exact on a bad header doesn' > $ echo a>>a > $ hg ci -m3 > $ hg export 2 | head -7 > ../a.patch > - $ hg export tip | tail -n +8 >> ../a.patch > + $ hg export tip | tail +8 >> ../a.patch > > $ cd .. > $ hg clone -qr0 repo3 repo3-clone > > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler wrote: > On Mon, Aug 26, 2013 at 10:28:36AM -0700, Danek Duvall wrote: > > # HG changeset patch > > # User Danek Duvall <danek.duvall@oracle.com> > > # Date 1377297397 25200 > > # Node ID 7d2fe0113e5c21bc204616649256d1bb59d7d7f5 > > # Parent bd488d5b5763ef8c4bc7b4a69e4073861e2487a1 > > solaris: tests can't use tail -n > > Afraid we'll have to come up with another solution for this: > > + tail: cannot open `+8' for reading: No such file or directory Bah. I guess I was hoping that those versions were basically no longer in use -- I tried this against coreutils 8.16, and it works just fine. Should I go the in-line python route? I'm hoping that Solaris tail will grow the -n option reasonably soon, so I could just drop this for now, and recognize this as an acceptable error, but it'd be nice to have clean test runs. I could also just patch our local builds. Or give up on not using the GNU utilities. No solution is particularly attractive to me. :( Thanks, Danek
On Aug 26, 2013, at 5:31 PM, Danek Duvall <danek.duvall@oracle.com> wrote: > Augie Fackler wrote: > >> On Mon, Aug 26, 2013 at 10:28:36AM -0700, Danek Duvall wrote: >>> # HG changeset patch >>> # User Danek Duvall <danek.duvall@oracle.com> >>> # Date 1377297397 25200 >>> # Node ID 7d2fe0113e5c21bc204616649256d1bb59d7d7f5 >>> # Parent bd488d5b5763ef8c4bc7b4a69e4073861e2487a1 >>> solaris: tests can't use tail -n >> >> Afraid we'll have to come up with another solution for this: >> >> + tail: cannot open `+8' for reading: No such file or directory > > Bah. I guess I was hoping that those versions were basically no longer in > use -- I tried this against coreutils 8.16, and it works just fine. This was the tail that came with my ubuntu workstation (whatever latest LTS is, I think precise?) > > Should I go the in-line python route? Yeah, may as well. > I'm hoping that Solaris tail will > grow the -n option reasonably soon, so I could just drop this for now, and > recognize this as an acceptable error, but it'd be nice to have clean test > runs. I could also just patch our local builds. Or give up on not using > the GNU utilities. No solution is particularly attractive to me. :( I think in-line Python is probably the least bad for now :/ Let's have the test suite honestly pass on Solaris, despite its faults. > > Thanks, > Danek
Augie Fackler <raf@durin42.com> writes: > On Aug 26, 2013, at 5:31 PM, Danek Duvall <danek.duvall@oracle.com> wrote: > >> Augie Fackler wrote: >> >>> On Mon, Aug 26, 2013 at 10:28:36AM -0700, Danek Duvall wrote: >>>> # HG changeset patch >>>> # User Danek Duvall <danek.duvall@oracle.com> >>>> # Date 1377297397 25200 >>>> # Node ID 7d2fe0113e5c21bc204616649256d1bb59d7d7f5 >>>> # Parent bd488d5b5763ef8c4bc7b4a69e4073861e2487a1 >>>> solaris: tests can't use tail -n >>> >>> Afraid we'll have to come up with another solution for this: >>> >>> + tail: cannot open `+8' for reading: No such file or directory >> >> Bah. I guess I was hoping that those versions were basically no longer in >> use -- I tried this against coreutils 8.16, and it works just fine. > > This was the tail that came with my ubuntu workstation (whatever > latest LTS is, I think precise?) > >> >> Should I go the in-line python route? > > Yeah, may as well. What about letting the test suite install a helper (Python) script that behaves the way we want -- call it 'hgtail' to make it clear that it's a not the system 'tail' command. We already have some helpers like this (md5sum.py, printenv.py, readlink.py) so maybe one could standardize the system a bit. Something like having a tests/helpers/ dir which is automatically put on PATH when the tests are run.
Patch
diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -68,6 +68,7 @@ testpats = [ (r'echo -n', "don't use 'echo -n', use printf"), (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"), (r'head -c', "don't use 'head -c', use 'dd'"), + (r'tail -n', "don't use the '-n' option to tail, just use '-<num>'"), (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"), (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"), (r'printf.*[^\\]\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"), diff --git a/tests/test-import-merge.t b/tests/test-import-merge.t --- a/tests/test-import-merge.t +++ b/tests/test-import-merge.t @@ -129,7 +129,7 @@ Test that --exact on a bad header doesn' $ echo a>>a $ hg ci -m3 $ hg export 2 | head -7 > ../a.patch - $ hg export tip | tail -n +8 >> ../a.patch + $ hg export tip | tail +8 >> ../a.patch $ cd .. $ hg clone -qr0 repo3 repo3-clone