]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/regression/README
Open-code proc_set_cred_init()
[FreeBSD/FreeBSD.git] / tools / regression / README
1
2 This directory is for regression test programs.
3
4 A regression test program is one that will exercise a particular bit of the
5 system to check that we have not reintroduced an old bug.
6
7 Tests should be implemented in files with a .t extension.  Each .t file
8 can contain more than one test, and can be implemented in any scripting
9 language -- /bin/sh, Perl...
10
11 The test protocol is quite simple.  At its most basic, each .t file should, 
12 when run, print a line in this format:
13
14    1..m
15
16 where m is the number of tests that will be run.
17
18 Each test should produce a single line of output.  This line should start
19 with one of
20
21    ok n
22    not ok n
23
24 to indicate whether or not the test succeeded.  'n' is the test's number.
25 Anything after this on the line (up to the first '#' if present) is 
26 considered to be the name of the test.  Naming tests is optional, but 
27 encouraged.
28
29 A test may be written which is conditional, and may need to be skipped.
30 For example, the netinet tests require 'options INET' in the kernel.
31 A test may be skipped by printing '# skip Reason for skipping' after the
32 test name.  For example,
33
34     ok 1 - netinet # skip 'options INET' not compiled in
35
36 A test may be flagged as 'todo'.  This indicates that you expect the test
37 to fail (perhaps because the necessary functionality hasn't been written
38 yet).  'todo' tests are expected to fail, so when they start working the
39 test framework can alert you to this happy occurrence.  Flag these tests 
40 with a '# TODO' comment after the test name
41
42     not ok 1 - infiniteloop # TODO write test for an infinite loop
43
44 This is modelled on the protocol followed by the Test::Harness Perl
45 module (and therefore much of the automated testing carried out by the 
46 Perl community).  More documentation can be found at:
47
48     http://search.cpan.org/~petdance/Test-Harness-2.42/lib/Test/Harness.pm
49
50 To run the tests and parse their output install the devel/p5-Test-Harness
51 port.  This includes the prove(1) command which is used to run the tests
52 and collate the output.
53
54     prove geom_concat           # run all the tests in geom_concat
55     prove -r lib                # run all tests in lib/, and subdirectories
56     prove -r -v lib             # as above, with verbose output
57     prove -r                    # run *all* the tests
58
59 Tests that are for parts of the base system should go into a directory here
60 which is the same as their path relative to src/, for example the uuencode(1)
61 utility resides in src/usr.bin/uuencode so its regression test resides in
62 src/tools/regression/usr.bin/uuencode.
63
64 To avoid the pre-commit check program complaining about the lack of
65 CVS keywords in test data files, use a .in suffix for input files and
66 a .out suffix for output files.
67
68 To execute individual regression tests for binaries that you are
69 developing, add their directory in the path before running the tests.
70 Example:
71 cd /usr/src/tools/regression/usr.bin
72 (PATH=/home/user/src/experimental/jot:$PATH ; make SUBDIR=jot)
73
74 Please make a subdir per other regression test, and add a brief description to
75 this file.
76
77 acct            Exercise the integer to float conversion used in acct(5)
78 geom            Some tests and an out-of-kernel simulator for the GEOM code
79 nfsmmap         Some tests to exercise some tricky cases in NFS and mmap
80 p1003_1b        Exercise 1003.1B scheduler
81 pipe            Pipe code regression test
82 fsx             General filesystem exerciser
83 sysvmsg         SysV IPC Message Queue Regression Utility
84 sysvsem         SysV IPC Semaphore Regression Utility
85 sysvshm         SysV IPC Shared Memory Regression Utility
86 gaithrstress    General threaded getaddrinfo(3) exerciser
87 date            Date(1) + format string regression test