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. 31*45c203fcSGleb SmirnoffFor example, the netinet tests require 'options INET' in the kernel. 3200e13b1dSNik ClaytonA test may be skipped by printing '# skip Reason for skipping' after the 3300e13b1dSNik Claytontest name. For example, 3400e13b1dSNik Clayton 35*45c203fcSGleb Smirnoff ok 1 - netinet # skip 'options INET' 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 408ce070c1SUlrich Spörleintest framework can alert you to this happy occurrence. 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 65ffc44a27SDiomidis SpinellisTo avoid the pre-commit check program complaining about the lack of 66ffc44a27SDiomidis SpinellisCVS keywords in test data files, use a .in suffix for input files and 67ffc44a27SDiomidis Spinellisa .out suffix for output files. 68ffc44a27SDiomidis Spinellis 69259dde6eSDiomidis SpinellisTo execute individual regression tests for binaries that you are 70259dde6eSDiomidis Spinellisdeveloping, add their directory in the path before running the tests. 71259dde6eSDiomidis SpinellisExample: 72259dde6eSDiomidis Spinelliscd /usr/src/tools/regression/usr.bin 73259dde6eSDiomidis Spinellis(PATH=/home/user/src/experimental/jot:$PATH ; make SUBDIR=jot) 74259dde6eSDiomidis Spinellis 7588ef0373SJuli MallettPlease make a subdir per other regression test, and add a brief description to 7688ef0373SJuli Mallettthis file. 776527fda5SDoug Rabson 78ffc44a27SDiomidis Spinellisacct Exercise the integer to float conversion used in acct(5) 7980ad7ca9SJuli Mallettgeom Some tests and an out-of-kernel simulator for the GEOM code 80938e27a7SMarcel Moolenaaria64 ia64 specific regression tests 816527fda5SDoug Rabsonnfsmmap Some tests to exercise some tricky cases in NFS and mmap 82e5f1b1b1SPeter Dufaultp1003_1b Exercise 1003.1B scheduler 83af1a7621SPierre Beyssacpipe Pipe code regression test 8461404abcSJordan K. Hubbardfsx General filesystem exerciser 85ba05755cSAlfred Perlsteinsysvmsg SysV IPC Message Queue Regression Utility 86ba05755cSAlfred Perlsteinsysvsem SysV IPC Semaphore Regression Utility 87ba05755cSAlfred Perlsteinsysvshm SysV IPC Shared Memory Regression Utility 88e858faa9SBrian Feldmangaithrstress General threaded getaddrinfo(3) exerciser 8984ccb25dSEdwin Groothuisdate Date(1) + format string regression test 90