Understanding make test

Revision as of 07:45, 24 November 2011 by Amitay (talk | contribs) (Created page with "== Introduction == In samba development, one sure way to check if your code has not broken any existing functionality is to execute following command. <pre> make test </pre> Th…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

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_BINARY=./buildtools/bin/waf
WAF=WAF_MAKE=1 $(WAF_BINARY)

all:
        $(WAF) build

install:
        $(WAF) install

uninstall:
        $(WAF) uninstall

test:
        $(WAF) test $(TEST_OPTIONS)

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

Digging Deeper