summaryrefslogtreecommitdiffstats
path: root/server/tests/common.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename server/ directory to src/Stephen Gallagher2010-02-181-21/+0
| | | | Also update BUILD.txt
* Fix handling of the global context in the leak detectorSumit Bose2010-02-101-1/+1
|
* Make resolve and failover test work with CK_FORK=noSumit Bose2010-02-031-0/+2
| | | | | | | | | | | | | | | The leak checking code which is used by the resolve and failover tests frees talloc's autofree context which is not recommended. As a consequence the initialization of tevent failed when it was called by the second test and CF_FORK=no, because it holds some data in the autofree context. This patch introduces a global talloc context which should be uses by the test as the root of their memory hierarchy instead of NULL. This global context is used in the leak checking routines. Not all types of memory leaks can be detected by the new version , it is recommended to use valgrind or similar tools additionally.
* Add a new set of helpful common functions for testsMartin Nagy2009-10-221-0/+19
The leak_check_setup() and leak_check_teardown() functions can be added to a test case with tcase_add_checked_fixture(). They will make sure that all tests are checked for memory leaks. However, since talloc is hierarchical and automatically frees the children, this will not catch all cases, but might still be helpful. The check_leaks(ctx, bytes) function takes a talloc context as an argument and the number of bytes it should be using up (children included). The total byte size used up by the context is determined by the talloc_total_size() function. If the size doesn't agree, check_leaks() will print out a talloc report on the context and makes the current test fail. The check_leaks_push() and check_leaks_pop() both take a talloc context as an argument. Every time push is called, the context is "pushed" onto an internal stack and it's current size is noted. When the context is later "poped", the pop function will make sure that the size is the same as when it was pushed. It will also check that it's not called out-of-order or if the stack isn't empty.