xref: /freebsd/tools/regression/README (revision 259dde6e74c6b619c1d95b4dd20b732f3dfee145)
1e5f1b1b1SPeter Dufault$FreeBSD$
2e5f1b1b1SPeter Dufault
39e9d8a46SPoul-Henning KampThis directory is for regression test programs.
49e9d8a46SPoul-Henning Kamp
503bbd5ccSMike PritchardA regression test program is one that will exercise a particular bit of the
69e9d8a46SPoul-Henning Kampsystem to check that we have not reintroduced an old bug.
79e9d8a46SPoul-Henning Kamp
800e13b1dSNik ClaytonTests should be implemented in files with a .t extension.  Each .t file
900e13b1dSNik Claytoncan contain more than one test, and can be implemented in any scripting
1000e13b1dSNik Claytonlanguage -- /bin/sh, Perl...
1100e13b1dSNik Clayton
1200e13b1dSNik ClaytonThe test protocol is quite simple.  At its most basic, each .t file should,
1300e13b1dSNik Claytonwhen run, print a line in this format:
1400e13b1dSNik Clayton
1500e13b1dSNik Clayton   1..m
1600e13b1dSNik Clayton
1700e13b1dSNik Claytonwhere m is the number of tests that will be run.
1800e13b1dSNik Clayton
1900e13b1dSNik ClaytonEach test should produce a single line of output.  This line should start
2000e13b1dSNik Claytonwith one of
2100e13b1dSNik Clayton
2200e13b1dSNik Clayton   ok n
2300e13b1dSNik Clayton   not ok n
2400e13b1dSNik Clayton
2500e13b1dSNik Claytonto indicate whether or not the test succeeded.  'n' is the test's number.
2600e13b1dSNik ClaytonAnything after this on the line (up to the first '#' if present) is
2700e13b1dSNik Claytonconsidered to be the name of the test.  Naming tests is optional, but
2800e13b1dSNik Claytonencouraged.
2900e13b1dSNik Clayton
3000e13b1dSNik ClaytonA test may be written which is conditional, and may need to be skipped.
3100e13b1dSNik ClaytonFor example, the netatalk tests require 'options NETATALK' in the kernel.
3200e13b1dSNik ClaytonA test may be skipped by printing '# skip Reason for skipping' after the
3300e13b1dSNik Claytontest name.  For example,
3400e13b1dSNik Clayton
3500e13b1dSNik Clayton    ok 1 - netatalk # skip 'options NETATALK' not compiled in
3600e13b1dSNik Clayton
3700e13b1dSNik ClaytonA test may be flagged as 'todo'.  This indicates that you expect the test
3800e13b1dSNik Claytonto fail (perhaps because the necessary functionality hasn't been written
3900e13b1dSNik Claytonyet).  'todo' tests are expected to fail, so when they start working the
4000e13b1dSNik Claytontest framework can alert you to this happy occurence.  Flag these tests
4100e13b1dSNik Claytonwith a '# TODO' comment after the test name
4200e13b1dSNik Clayton
4300e13b1dSNik Clayton    not ok 1 - infiniteloop # TODO write test for an infinite loop
4400e13b1dSNik Clayton
4500e13b1dSNik ClaytonThis is modelled on the protocol followed by the Test::Harness Perl
4600e13b1dSNik Claytonmodule (and therefore much of the automated testing carried out by the
4700e13b1dSNik ClaytonPerl community).  More documentation can be found at:
4800e13b1dSNik Clayton
4900e13b1dSNik Clayton    http://search.cpan.org/~petdance/Test-Harness-2.42/lib/Test/Harness.pm
5000e13b1dSNik Clayton
5100e13b1dSNik ClaytonTo run the tests and parse their output install the devel/p5-Test-Harness
5200e13b1dSNik Claytonport.  This includes the prove(1) command which is used to run the tests
5300e13b1dSNik Claytonand collate the output.
5400e13b1dSNik Clayton
5500e13b1dSNik Clayton    prove geom_concat		# run all the tests in geom_concat
5600e13b1dSNik Clayton    prove -r lib		# run all tests in lib/, and subdirectories
5700e13b1dSNik Clayton    prove -r -v lib		# as above, with verbose output
5800e13b1dSNik Clayton    prove -r			# run *all* the tests
5900e13b1dSNik Clayton
6088ef0373SJuli MallettTests that are for parts of the base system should go into a directory here
6188ef0373SJuli Mallettwhich is the same as their path relative to src/, for example the uuencode(1)
6288ef0373SJuli Mallettutility resides in src/usr.bin/uuencode so its regression test resides in
6388ef0373SJuli Mallettsrc/tools/regression/usr.bin/uuencode.
6488ef0373SJuli Mallett
65259dde6eSDiomidis SpinellisTo execute individual regression tests for binaries that you are
66259dde6eSDiomidis Spinellisdeveloping, add their directory in the path before running the tests.
67259dde6eSDiomidis SpinellisExample:
68259dde6eSDiomidis Spinelliscd /usr/src/tools/regression/usr.bin
69259dde6eSDiomidis Spinellis(PATH=/home/user/src/experimental/jot:$PATH ; make SUBDIR=jot)
70259dde6eSDiomidis Spinellis
7188ef0373SJuli MallettPlease make a subdir per other regression test, and add a brief description to
7288ef0373SJuli Mallettthis file.
736527fda5SDoug Rabson
7480ad7ca9SJuli Mallettgeom		Some tests and an out-of-kernel simulator for the GEOM code
75938e27a7SMarcel Moolenaaria64		ia64 specific regression tests
766527fda5SDoug Rabsonnfsmmap		Some tests to exercise some tricky cases in NFS and mmap
77e5f1b1b1SPeter Dufaultp1003_1b	Exercise 1003.1B scheduler
78af1a7621SPierre Beyssacpipe		Pipe code regression test
7961404abcSJordan K. Hubbardfsx		General filesystem exerciser
80ba05755cSAlfred Perlsteinsysvmsg 	SysV IPC Message Queue Regression Utility
81ba05755cSAlfred Perlsteinsysvsem 	SysV IPC Semaphore Regression Utility
82ba05755cSAlfred Perlsteinsysvshm 	SysV IPC Shared Memory Regression Utility
83e858faa9SBrian Feldmangaithrstress	General threaded getaddrinfo(3) exerciser
84