Samba Testing Framework and t_push_ucs2
mbp at samba.org
Wed Apr 9 05:18:22 GMT 2003
abartlet's new push_ucs2 test has been integrated into the new Samba
Testing Framework "make check". I think it makes a pretty good
example of the testing system that Tim and I have been working on.
The structure is more or less like this:
- We have some C code that needs to be tested (push_ucs2_allocate,
- This code is "exposed" by a little C harness program that links
with -lbigballofmud and allows the function to be called
interactively. (see torture/t_push_ucs2.c, Makefile.in)
This harness is very handy by itself: you can run it through
valgrind or cachegrind to check performance and correctness for
various inputs. It allows the function to be tested in isolation.
Making it a standalone program is handy because it avoids possible
memory corruption or other effects carrying over from one test run
to another, and it's very easy to poke interactively or to drive
from a debugger.
- The harness is called by a little bit of Python code in STF that
runs the harness across various parts of the test domain and
checks the results.
I did this in Python because it's well suited to producing
different inputs and controlling variations of tests: a bit more
high-level and standardized than shell, and easier to write than
There are a fair number of utilities provided so you shouldn't
need to know a lot of Python to use it. I expect most test
harnesses can just be fed different inputs and you can get that by
copying an existing test.
- Doing "make check" in the samba source tree runs all the default
Coverage through this mechanism is very low at the moment but we hope
to improve it. It should be a good foundation for bottom-up unit and
More information about the samba-technical