[PATCH 0 of 5] Add 'unified' tests to the test framework

Matt Mackall mpm at selenic.com
Thu Aug 12 14:50:44 CDT 2010


On Thu, 2010-08-12 at 17:07 +0900, Nicolas Dumazet wrote:

> The only issue that I found so far was with commands that do not include an
> EOL. echo -n, and cat of files without EOL is broken, because the output will
> mix the echo'ed content and the following SALT:
> 
> -  $ echo -n "foobar"
> +  foobarSALTxxxxxxxxx.xx YYY

Hmm, we could probably fix that easily enough. The whole 'SALT...' thing
shouldn't appear in any output, so if we see it anywhere on a line, we
know what's up. Sticking stuff back in the output stream isn't too
painful, but we'll have to switch away from a for loop.

Another known gotcha is $?. The tracing statements interfere with it. So
you can either do:

  hg foo; echo $?

To get a result code with no interference, or else we can detect $? in a
command and do something like:

  (HGRESULTTEMP=$?; echo SALT....; exit $HGRESULTTEMP) 


Before we go ahead and convert all the tests by hand, I've got the start
of a script that automates (part of) it. Ideally we want to:

- detect comments and turn them into "body text"
- detect commands and turn them into $ lines
- deal with multiline statements
- run the resultant .t file through the test engine
- extract the command output lines from .t.err
- double-check them against the known-good original .out file
- if everything's good, move the .t.err to .t
- do appropriate renaming/deletion of the old files
- manually pretty-up the body text before committing

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list