Debugging individual tests

Revision as of 13:52, 19 April 2010 by AndrewTridgell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Debugging individual tests in Samba4

There are many ways to debug failing tests in Samba4. This will give some of the more useful techniques.


It can be useful to run Samba in a normal shell but under the selftest environment. One way to do that is this:

  • start two shells
  • in both shells, cd to the source4 directory of a built tree
  • in one of the shells, run at least one selftest. I usually just do "make quicktest". You don't need to wait for it to complete
  • in both shells run
. scripting/devel/

That sets up all the environment variables normally used in the selftest system

  • in the first shell, run
bin/samba -i -M single -d2

that starts a copy of Samba, using the selftest vars

  • in the second shell, run the failing command from the "expanded command" log, for example:
./selftest/../../nsswitch/tests/ SAMBADOMAIN Administrator localdcpass member
  • it should run just as in a normal selftest

Now you can reproduce the error, you often want to run just one part of it. Try this:

bash -x ./selftest/../../nsswitch/tests/ SAMBADOMAIN Administrator localdcpass member 2>&1 |less

that allows you to see the individual shell commands. You can then see the failure. Then you may run that individual command like this:

bin/wbinfo -u

then to narrow it down, use valgrind

valgrind -q bin/wbinfo -u