BSD.REGRESS.MK(5) - File Formats Manual #
BSD.REGRESS.MK(5) - File Formats Manual
NAME #
bsd.regress.mk - regression test master Makefile fragment
SYNOPSIS #
.include <bsd.regress.mk>
DESCRIPTION #
bsd.regress.mk holds the standard routines used by the source regression tests. Some variables and targets are for its internal use only. The rest are documented here.
Since this file also includes bsd.prog.mk, all of the usual OpenBSD Makefile variables may be used to build the regression test programs.
TARGETS #
depend
Build any dependencies required to carry out the current set of regression tests.
regress
Executes the regression targets defined in the Makefile. If a tests fails, the line “FAILED” is printed to the standard output. By default, execution stops after the first test failure and make regress exits with a non-zero status.
run-regress-*
Runs an individual regression test. If the exit status of the program indicates an error or timeout, then a failure is logged, otherwise the test is marked as a success.
VARIABLES #
REGRESS_CLEANUP
If this variable is set, it contains a target that is executed after all regress targets.
REGRESS_EXPECTED_FAILURES
Targets which are expected to fail. Specifically: sometimes tests are added for features that should be supported eventually, but are somewhat complicated to fix right away.
REGRESS_FAIL_EARLY
If this variable is set to anything but “no”, the regress target will abort as soon as a test fails. Defaults to “yes” unless
REGRESS_LOG
is set.
REGRESS_LOG
Points to the fully-qualified path of a file to which regression results are appended. Defaults to /dev/null. If set to any other path,
REGRESS_FAIL_EARLY
defaults to “no”.
REGRESS_ROOT_TARGETS
Targets for which root access is required to run the test. The
SUDO
variable should be used in the test parts that require root. See alsoSUDO
.
REGRESS_SETUP
If this variable is set, it contains a target that is executed before each regress target. Regress targets depend on this one to enforce setup.
REGRESS_SETUP_ONCE
If this variable is set, it contains a target that is executed once before all regress targets. Regress targets depend on a stamp file generated during setup.
REGRESS_SKIP_SLOW
If this variable is not empty, skip over all the regression tests which have been marked as being ‘slow’ using the
REGRESS_SLOW_TARGETS
variable.
REGRESS_SKIP_TARGETS
Targets which are unconditionally skipped.
REGRESS_SLOW_TARGETS
Targets which are defined as ‘slow’. All of these tests can be skipped by setting the
REGRESS_SKIP_SLOW
variable.
REGRESS_TARGETS
Targets which are invoked to run the set of regression tests for this Makefile. Defaults to run-regress-${PROG}.
SUDO
Location of a command used to switch to root for certain test targets which require it. See doas(1).
Some variables are intended to be set at runtime in the environment or in mk.conf(5), but not in the regress Makefile itself.
GUIDELINES #
If an individual test passes, make testname should return with an exit status of 0. If it fails, it should return with a non-zero exit status.
If a test cannot be executed because a package is not installed or some environment variable is not set, make testname should print “SKIPPED” to stdout and exit with status 0. To skip everything, implement the regress target with a command that prints “SKIPPED”.
Some tests may require a special setup on the test machine that has to be done manually before testing. This requirement has to be documented in the Makefile or in a README file. The test should find out whether the setup exists before running and print “SKIPPED” and exit if it is missing.
Tests should not fail because an intended feature has not been implemented yet. To avoid such false failures, a test should show the reason, print “DISABLED” to stdout and exit with status 0.
Tests must be able to run with an obj directory. In case the test is not linked to the build or the tester forgot to run make obj before, this directory or symlink may not exist. Then the test should run anyway.
Tests are executed with make regress, but running make all or make should have the same effect. Tests must be runnable by root, and may also succeed when run as a regular user. Tests must not assume they have a controlling tty, to allow them to be run by cron(8). An individual regress test may create a pseudo tty if it needs one.
Tests should use the binaries installed and the kernel running on
the local system.
They may use environment variables to test alternative binaries or
remote kernels running on other machines.
In some cases a test may need binaries or libraries or object files
to be present in
/usr/obj/
that exist only after
make build
was run in
/usr/src/.
The test must not assume that they have already been built, but
should run
make
in the appropriate source directory as a dependency.
For missing generated source or header files a target called
make generated
is common.
The
/usr/src/
tree can be found with a relative path or with the
BSDSRCDIR
variable.
Tests should generally not set or modify
MALLOC_OPTIONS
unless it is testing specific behaviour that depends on a particular
flag or combination of flags.
When running tests, the appropriate sysctl
(vm.malloc_conf)
could be used instead.
SEE ALSO #
HISTORY #
The regression system originally came from NetBSD, with many tests added by OpenBSD since. The current Makefile framework was written by Artur Grabowski and Marc Espie for OpenBSD 3.1.
OpenBSD 7.5 - November 13, 2023