Understanding make test

Revision as of 00:57, 29 November 2011 by Amitay (talk | contribs) (Introduction)


In samba development, one sure way to check if your code has not broken any existing functionality is to execute following command.

make test

This command tests various parts of samba code base to ensure the correctness of the functionality. It uses the test framework built in samba code base to perform hundreds of tests. It does take a fair bit of time to execute all the tests. If all the tests are successful, ALL OK is issued and the summary of the results can be found in st/summary file. In case any of the tests are unsuccessful, st/summary file should indicate whether the failures are and st/subunit file will capture all the output for all the tests.

What's quicktest

Often you can test the core functionality, by performing a quick test as follows.

make quicktest

This will perform few dozen tests to quickly check if anything is broken in the code.

How to find what tests are there?

If you are impatient and want to find what all tests are performed, use the following command.

make test LIST=1

To understand how this command really works, keep reading.

How to run a particular test or a set of tests

Each test in samba has an unique name. To run a particular test, you can specify the test name to TESTS argument.

make test TESTS=samba3.blackbox.net.local.registry.roundtrip

The argument TESTS is really a regular expression. Any test name that matches the regular expression will be executed. To execute the same test, one can use the following command.

make test TESTS=roundtrip

Now, this will execute two tests - samba3.blackbox.net.local.registry.roundtrip and samba3.blackbox.net.rpc.registry.roundtrip.

Some 'Waf'fling

Samba uses python based build system called waf. If you are only used to automake/make/cmake family for building applications, then waf can be a bit daunting. Just like you have Makefile for make, there are wscript files for waf. A wscript file is really a python script file. And the build targets are defined as python functions.

To get familiar with waf, you can check these links.

Samba has extended waf to wafsamba, to make it easier for developers to specify targets and their dependencies.

Why waf?

Make magic

The waf build system is wrapped at the top level inside a Makefile.

# simple makefile wrapper to run waf


        $(WAF) build

        $(WAF) install

        $(WAF) uninstall

        $(WAF) test $(TEST_OPTIONS)

make test really executes waf program as ./buildtools/bin/waf with test as an argument.

Digging Deeper