1src/tests: The FreeBSD test suite
4To run the FreeBSD test suite:
5(1) Make sure that kyua is installed:
6 pkg install kyua
7(2) To run the tests:
8 kyua test -k /usr/tests/Kyuafile
9(3) To see the test results:
10 kyua report
12For further information on using the test suite, read tests(7):
13 man tests
15Description of FreeBSD test suite
17The build of the test suite is organized in the following manner:
19* The build of all test artifacts is protected by the MK_TESTS knob.
20 The user can disable these with the WITHOUT_TESTS setting in
23* The goal for /usr/tests/ (the installed test programs) is to follow
24 the same hierarchy as /usr/src/ wherever possible, which in turn drives
25 several of the design decisions described below. This simplifies the
26 discoverability of tests. We want a mapping such as:
28 /usr/src/bin/cp/ -> /usr/tests/bin/cp/
29 /usr/src/lib/libc/ -> /usr/tests/lib/libc/
30 /usr/src/usr.bin/cut/ -> /usr/tests/usr.bin/cut/
31 ... and many more ...
33* Test programs for specific utilities and libraries are located next
34 to the source code of such programs. For example, the tests for the
35 src/lib/libcrypt/ library live in src/lib/libcrypt/tests/. The tests/
36 subdirectory is optional and should, in general, be avoided.
38* The src/tests/ hierarchy (this directory) provides generic test
39 infrastructure and glue code to join all test programs together into
40 a single test suite definition.
42* The src/tests/ hierarchy also includes cross-functional test programs:
43 i.e. test programs that cover more than a single utility or library
44 and thus don't fit anywhere else in the tree. Consider this to follow
45 the same rationale as src/share/man/: this directory contains generic
46 manual pages while the manual pages that are specific to individual
47 tools or libraries live next to the source code.
49In order to keep the src/tests/ hierarchy decoupled from the actual test
50programs being installed --which is a worthy goal because it simplifies
51the addition of new test programs and simplifies the maintenance of the
52tree-- the top-level Kyuafile does not know which subdirectories may
53exist upfront. Instead, such Kyuafile automatically detects, at
54run-time, which */Kyuafile files exist and uses those directly.
56Similarly, every directory in src/ that wants to install a Kyuafile to
57just recurse into other subdirectories reuses this Kyuafile with
58auto-discovery features. As an example, take a look at src/lib/tests/
59whose sole purpose is to install a Kyuafile into /usr/tests/lib/.
60The goal in this specific case is for /usr/tests/lib/ to be generated
61entirely from src/lib/.