Development/RegressionTests
The basics
So you've been asked to submit a regression test. Here's how to get started.
darcs get http://darcs.net
cp tests/EXAMPLE.sh tests/failing-issueXXXX_your-test.sh
# edit away
darcs record
darcs send
Regression tests are just shell scripts that fail on the first command that returns with a non-zero exit status.
See tests/EXAMPLE.sh to get a template for writing these tests. Note also the tests/lib for things you should be able to invoke from your test or tests/toolbox.sh for little tricks you can copy and paste.
NB. If you're not actually expecting your test to fail, then remove 'failing-' from the name.
Tips
- Name your patch
Accept issueNNNN: (short description) - Just let
darcs senddo the thinking (no arguments or flags needed). The darcs repository will automatically specify what email address to send the patch to (one which will cause a patch tracker ticket to be created for your patch). - See the Patches checklist
Things to avoid
- cp -a (BSD)
- sed -r (BSD)
- sed -i (BSD)
- yes | (doesn't terminate on OpenBSD when SIGPIPE is ignored by the shell, could be fixed by trap - PIPE in the script)
- find ... -exec ... {} + (Not supported on OpenBSD)
- grep -F (use fgrep instead)
If in doubt, look it up at http://www.opengroup.org/bookstore/catalog/c082.htm, but be aware that not all systems are conforming to the latest SUS.
