more description of testing framework
This commit is contained in:
@@ -4,15 +4,21 @@ testing. Each test is actually fairly simple: it is a comparison of standard
|
|||||||
output and standard error, as per the program specification.
|
output and standard error, as per the program specification.
|
||||||
|
|
||||||
In any given program specification directory, there exists a specific `tests/`
|
In any given program specification directory, there exists a specific `tests/`
|
||||||
directory which holds the expected standard output and error in files called
|
directory which holds the expected return code, standard output, and standard
|
||||||
`n.out` and `n.err` for each test `n`. The testing framework just starts at
|
error in files called `n.rc`, `n.out`, and `n.err` (respectively) for each
|
||||||
`1` and keeps incrementing tests until it can't find any more or encounters a
|
test `n`. The testing framework just starts at `1` and keeps incrementing
|
||||||
failure. Thus, adding new tests is easy; just add the relevant files to the
|
tests until it can't find any more or encounters a failure. Thus, adding new
|
||||||
tests directory at the lowest available number.
|
tests is easy; just add the relevant files to the tests directory at the
|
||||||
|
lowest available number.
|
||||||
|
|
||||||
A couple of other files are needed to fully describe a test. The first is a
|
The files needed to describe a test number `n` are:
|
||||||
run file (e.g., `n.run`) which shows exactly how to run the test; the second
|
- `n.rc`: The return code the program should return (usually 0 or 1)
|
||||||
is a description file (e.g., `n.desc`) which just describes the test.
|
- `n.out`: The standard output expected from the test
|
||||||
|
- `n.err`: The standard error expected from the test
|
||||||
|
- `n.run`: How to run the test (which arguments it needs, etc.)
|
||||||
|
- `n.desc`: A short text description of the test
|
||||||
|
- `n.pre` (optional): Code to run before the test, to set something up
|
||||||
|
- `n.post` (optional): Code to run after the test, to clean something up
|
||||||
|
|
||||||
In most cases, a wrapper script is used to call `run-tests.sh` to do the
|
In most cases, a wrapper script is used to call `run-tests.sh` to do the
|
||||||
necessary work.
|
necessary work.
|
||||||
@@ -22,5 +28,5 @@ The options for `run-tests.sh` include:
|
|||||||
* `-v` (verbose: print what each test is doing)
|
* `-v` (verbose: print what each test is doing)
|
||||||
* `-t n` (run only test `n`)
|
* `-t n` (run only test `n`)
|
||||||
* `-c` (continue even after a test fails)
|
* `-c` (continue even after a test fails)
|
||||||
|
* `-d` (run tests not from `tests/` directory but from this directory instead)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user