ack/doc/lint/chap8

57 lines
1.7 KiB
Plaintext
Raw Normal View History

1991-09-30 17:58:00 +00:00
.NH 1
Testing the program
.PP
There is no test-suite for testing
.I lint.
I have written a lot of small files that each test one
particular property of the program.
At this moment there are about 220 test programs.
.PP
It would take a lot of time and effort to run these tests by hand.
To ease this work I wrote a program that runs these tests
automatically.
The test program (the program that runs the tests) needs, associated
with each .c file, a .w file, containing from each expected warning
a substring. E.g. when the following warnings should be given by
.I lint:
.DS B
.ft CW
file t.c, line 3, i evaluation order undefined
file t.c, line 6, a set but not used in function main
.R
.DE
it is sufficient to write a file \f(CWt.w\fP containing
.DS B
.ft CW
a set but not used in function main
i evaluation order undefined
.R
.DE
The test program is called with all the .c files to be tested
as arguments.
.PP
Sometimes it is necessary to test
.I lint
on two files.
The test program runs
.I lint
on two files when two consecutive
arguments are of the form \fIname\fPa.c and \fIname\fPb.c.
It then compares the output of
.I lint
with the file \fIname\fP.w.
.PP
.I Lint
is also tested by running it on existing programs.
.I Lint
has been run on some \s-2UNIX\s+2 utility programs in
/usr/src/cmd, on Unipress Emacs (consisting of more than 30,000
lines of code) and the program itself.
Bugs have been found in e.g. /usr/src/cmd/cat.c and
/usr/src/cmd/ld.c.
To test the robustness of the program, it was run on the
password file /etc/passwd and on `mixed' C program files.
These mixed C program files are C program files that were
broken in chunks and then put together in a different order.
.bp