[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.2 Writing new test cases

The test cases are really just shell scripts. They are suitable for /bin/sh on most machines. The procedure for running these is explained in 10.1 Running the tests. These shell scripts read in some common function definitions (mostly from tests/common/test-common) and then proceed to conduct the tests. This section explains those commands used in the test scripts that are not simply normal shell commands. Normal shell commands like sed and grep are not described.

10.2.1 docommand  Run a command, checking its return value and output.
10.2.2 remove  Remove a file if it is present.
10.2.3 success  Declare that a test has passed.
10.2.4 fail  Declare that a test has failed.
10.2.5 echo_nonl  Print a string without a following argument.
10.2.6 miscarry  When a test case cannot be run.

The best approach for writing new test scripts or just individual new test cases is to first think of some aspect that needs better test coverage, and then to write the test script, basing it on an existing script. At this stage the best strategy is to test the test script itself by running against a genuine edition of SCCS, if you have one available (before running make check, set the environment variable `dir' to point to the directory containing the programs to be tested; this should usually be `/usr/sccs'). When you are sure that the test script is expecting the correct behaviour from programs under test, you can then run it against CSSC. After all, if you're going to set out writing your test by assuming that CSSC is correct in the area under test, of what value is the test?


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April, 13 2002 using texi2html