[PATCH] test case fixes for Solaris

Danek Duvall danek.duvall at oracle.com
Wed Aug 21 17:14:58 CDT 2013


Matt Mackall wrote:

> I would have thought the Mercurial-on-Solaris community would be larger
> than the set using Cadmium.

I would expect so, too, but I just don't know.  I guess another possibility
is that they're putting /usr/gnu/bin first in $PATH, in which case this all
runs just fine (at least on S11).

> > > I think we probably shouldn't accept these without corresponding checks
> > > in contrib/check-code.py otherwise these will just be recurring problems
> > > that people on more mainstream Unices won't notice. Please separate out
> > > each class of breakage into a separate patch and include a corresponding
> > > check.
> > 
> > Okay.  Can I consider this confirmation that the workarounds I used were
> > appropriate?
> 
> Well I can't say I was super-thrilled by them, as we've been trying to
> remove filtery-hackery. I'd rather just replace the problem bits with
> approaches that avoid the problem. Diff doesn't work portably? If the
> files are small, how about cat?

Seems to be "diff -u" specifically when there's no difference.  We could
make the rule that when you expect no difference, you use plain "diff", or
"cmp", or something, though of course when something goes wrong, and there
*is* a difference, you either get less useful output (context diffs) or no
output at all (cmp).  test-command-template.t uses both cmp and diff,
running diff only if cmp finds differences.

I could write python code using difflib, but that seems like overkill.

I probably would gravitate towards using context diffs for no output
(assuming that you can write a test that checks both the command and its
output), or the cmp/diff combo if I can figure out that regex.  But I'm not
sure I'm qualified to make the decision here.

I'm really not sure how else to work around the lack of grep -a.

> But even where that's done, we'll want the check-code rule to avoid
> creep-back.
> 
> >   - I know that GNU head and tail at some point in the past started
> >     disallowing args like "-8" and +8", and required the use of -n, but
> >     then I think backed off of that change.  So I'm not sure what the right
> >     thing is here.
> 
> Probably complains on some machines still.

Right.  So if we have to deal with both, then we need an alternative to
tail.  You can use "sed -n 'x,$p'" as an alternative to "tail +x", but I'm
not sure how to emulate the "normal" tail operation with other shell
commands.

Again, I could write this in python, but ...

So I'd welcome your (or anyone else's) suggestions.

Thanks,
Danek


More information about the Mercurial-devel mailing list