[PATCH] test case fixes for Solaris
Matt Mackall
mpm at selenic.com
Thu Aug 22 15:06:00 CDT 2013
On Wed, 2013-08-21 at 15:14 -0700, Danek Duvall wrote:
> 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'm not super-worried about the case where the test fails and we get
weird output.
> I could write python code using difflib, but that seems like overkill.
Indeed.
> 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.
Perhaps use our inline Python support:
$ foo > bar
>>> for line in open('bar'):
... if 'baz' in line: print line
> > 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.
Looks like the two places that are using it are legacy from before we
had glob/regex support built into the test format.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list