[PATCH 0 of 2] tests: hghave || exit 80

Nicolas Dumazet nicdumz at gmail.com
Tue Apr 7 12:35:27 CDT 2009


Hello!

We use in several tests "hghave $feature || exit 80" to check for avaibility
of $feature before running a test: hghave exits with exitcode 0 only if
$feature is availabe. If $feature is not available, hghave exits with 
exitcode 1, which causes the test to exit with exitcode 80; and then run-tests 
checks the test exitcode to show a "skipped" message.

If, however, "hghave $feature" crashes (Traceback, caused for example by
a SyntaxError) it exits with exitcode 1, which in its turns exits the test with
errorcode 80... and run-tests prints happily a "test-skipped" message instead
of detecting a failure.

I have included two patches to avoid those issues:
* The first one makes sure that all hghave targets are crash-free
* The second one catches errors when hghave fails inside a test, to mark the
  test as failed.

Those two patches might look overlapping, but both are necessary:

1) when all hghave targets are tested for validity, a single test cannot 
   indeed fail on a hghave call. However if one introduces an error in, 
   say inotify, he will want test-inotify* tests to run (no skips), 
   and will want them to fail: one should not have to run test-hghave to 
   detect an error outside of hghave scope.
2) Simetrically, it is not because all individual tests calling hghave
   run correctly that all hghave targets are correct.


Regards,

Nicolas.


More information about the Mercurial-devel mailing list