introduction to the FreeBSD
Test Suite provides a collection of
automated tests for two major purposes. On one hand, the test suite aids
to detect bugs and regressions when
they modify the source tree. On the other hand, it allows
(and, in particular, system
administrators) to verify that fresh installations of the
operating system behave correctly on their
hardware platform and also to ensure that the system does not suffer from
regressions during regular operation and maintenance.
Test Suite can be found in the
This manual page describes how to run the test suite and how to configure some
of its optional features.
The test suite is installed by default as of FreeBSD
If the /usr/tests
directory is missing, then
you will have to enable the build of the test suite, rebuild your system and
install the results. You can do so by setting ‘WITH_TESTS=yes’
in your /etc/src.conf
for details) and rebuilding the system as described in
Before diving into the details of how to run the test suite, here are some
scenarios in which you should run it:
- After a fresh installation of FreeBSD to ensure
that the system works correctly on your hardware platform.
- After an upgrade of FreeBSD to a different version
to ensure that the new code works well on your hardware platform and that
the upgrade did not introduce regressions in your configuration.
- After modifying the source tree to detect any new bugs and/or
- Periodically, maybe from a
job, to ensure that any changes to the system (such as the installation of
third-party packages or manual modifications to configuration files) do
not introduce unexpected failures.
First, you will need to install the ‘devel/kyua’ package from
Then use the following command to run the whole test suite:
$ kyua test -k /usr/tests/Kyuafile
The above will iterate through all test programs in
recursively, execute them, store
their results and debugging data in Kyua's database (by default in
), and print a summary of
the results. This summary includes a brief count of all total tests run and
how many of them failed.
It is possible to restrict which tests to run by providing their names in the
command line. For example, this would execute the tests for the
$ kyua test -k /usr/tests/Kyuafile bin/cp usr.bin/cut
Additional information about the test results can be retrieved by using Kyua's
various reporting commands. For example, the following would print a
plain-text report of the executed tests and show which ones failed:
This example would generate an HTML report ready to be published on a web
$ kyua report-html --output ~/public_html/tests
For further details on the command-line interface of Kyua, please refer to its
Some test cases in the FreeBSD
Test Suite require manual
configuration by the administrator before they can be run. Unless certain
properties are defined, the tests that require them will be skipped.
Test suites are configured by defining their configuration variables in
. The format
of this file is detailed in
The following configuration variables are available in the
- If defined, enables tests that may destroy and recreate semipermanent
device nodes, like disk devices. Without this variable, tests may still
create and destroy devices nodes that are normally transient, like
/dev/tap* and /dev/pts*, as long as they clean them up afterwards.
However, tests that require this variable have a relaxed cleanup
requirement; they must recreate any devices that they destroyed, but not
necessarily with the same devnames.
- Enables tests that change globally significant
variables. The tests will undo any changes in their cleanup phases.
- Must be set to a space delimited list of disk device nodes. Tests that
need destructive access to disks must use these devices. Tests are not
required to preserve any data present on these disks.
- Must be set to a space delimited list of FIBs (routing tables). Tests that
need to modify a routing table may use any of these. Tests will cleanup
any new routes that they create.
If there is any failure
during the execution of the
test suite, please consider reporting it to the
developers so that the failure can be analyzed
and fixed. To do so, either send a message to the appropriate mailing list or
file a problem report. For more details please refer to:
- System-wide configuration file for
- User-specific configuration file for
overrides the system file.
- Default result database used by Kyua.
- Location of the FreeBSD Test Suite.
- Top-level test suite definition file.
Test Suite first appeared in
manual page first appeared in
and was later ported to