-
Notifications
You must be signed in to change notification settings - Fork 46
Test Suite
The MUNGE test suite uses Sharness for higher-level tests of the executables, and libtap for lower-level tests of the C internals. Sharness tests reside in the t/
directory, whereas libtap tests are located in the directories under src/
.
Both Sharness and libtap are TAP Producers, outputting test results according to the Test Anything Protocol. This TAP output can be fed into a TAP Consumer for further processing.
-
From the
check
target of the Makefile. Specify options by appending shell variables to themake
command.
make check root=/tmp/munge-$$ verbose=t
-
From the
prove
command. Specify--help
, or read theprove(1)
manpage or Perl docs.
prove -v 0010-basic.t
-
From the test itself. Specify options by prepending shell variables to the command, or appending command-line options.
./0010-basic.t --root=/tmp/munge-$$ -v
-
chain_lint
is a sharness variable for checking whether each test properly "&&-chains" all commands in order to ensure a failure of any command in the chain will cause the test to fail. Ifchain_lint=t
, sharness will perform this check in addition to running the tests. This is primarily intended for development. -
debug
is a sharness variable primarily intended for development. Ifdebug=t
, execution oftest_debug()
commands will be performed, and removal of "trash" directories (used to store all temporary data during the test) will be prevented in order to allow their contents to be inspected afterwards.
-
root
is a sharness variable for specifying a directory to be prepended to the "trash" directories (used to store all temporary data during the test). If this variable is not specified, these directories are created in the current working directory. They are removed after the test finishes unless a test fails ordebug=t
is specified. -
TEST_LONG
is a sharness variable for running tests marked as being "expensive". If this variable is not set, sharness tests requiringsudo
(expensive in privilege) orvalgrind
(expensive in memory and time) will be skipped. This is primarily intended for development. -
verbose
is a sharness variable for making test output more verbose. By default, standard output and standard error streams are discarded, and only a result of "ok" or "not ok" is reported. But ifverbose=t
, the test commands being run and their resulting output will be logged to the corresponding.log
files as well astest-suite.log
. -
VERBOSE
is an automake test harness variable. If set, the output from failed tests collected intest-suite.log
will be displayed after all tests have completed.
- Sharness tests checking the behavior of executables running as root use sudo to elevate privileges. They require sudo-1.7.0 or later. These tests will be skipped unless the
TEST_LONG
variable is set andsudo
is configured to run commands without prompting for a password (see theNOPASSWD:
tag insudoers(5)
).
- Sharness tests using valgrind to check for memory errors require valgrind-3.9.0 (2013-10-31) or later. These tests will be skipped unless the
TEST_LONG
variable is set and valgrind is installed.
-
If tests fail, try running the test suite with
verbose=t
and examiningt/test-suite.log
afterwards for more information. -
If your current working directory (or one of its parent directories) has overly-permissive permissions, you may see a multitude of errors noting various files and directories are insecure. Either correct the directory permissions, or try moving the "trash" directories to another filesystem such as
/tmp
(which should have the sticky-bit set) by running the test suite withroot=/tmp/munge-$$
. -
If your current working directory is inside an NFS mount, you may encounter race conditions with NFS locks; for example,
rm: cannot remove '/path/to/some/.nfs000000000123456789abcdef': Device or resource busy
. Try moving the "trash" directories to a non-NFS local filesystem by running the test suite withroot=/tmp/munge-$$
.