BIND 10 #614: Run unit tests with Valgrind

BIND 10 Development do-not-reply at isc.org
Fri Feb 25 19:54:51 UTC 2011


#614: Run unit tests with Valgrind
-------------------------------------+-------------------------------------
                 Reporter:  stephen  |                Owner:  UnAssigned
                     Type:  task     |               Status:  reviewing
                 Priority:  major    |            Milestone:  A-Team-
                Component:           |  Sprint-20110309
  Unclassified                       |           Resolution:
                 Keywords:           |            Sensitive:  0
Estimated Number of Hours:  0.0      |  Add Hours to Ticket:  0
                Billable?:  1        |          Total Hours:  0
                Internal?:  0        |
-------------------------------------+-------------------------------------
Changes (by vorner):

 * owner:  vorner => UnAssigned
 * status:  accepted => reviewing


Comment:

 Hello

 I have two scripts in the branch:

 '''tools/tests_in_valgrind.sh''':

 It runs the tests in valgrind (it is possible to provide different options
 and output file). But it is kind of nasty bash script (there are some
 things I use from bash, but if it was needed to run somewhere where it's
 not installed it would probably be possible to modify it without much
 effort).

 It finds the run_unittests (yes, by the name), copies them and modifies
 the line that executes the binary (these are wrapper scripts from
 autotools to provide the correct library paths).

 '''tools/valgrind_test_cleaner.pl''':

 It turned out that there are many memory leaks reported from the tests
 only, this one is able to throw out the leak reports whose backtrace
 contain no function from our tested code.

 This is written in perl. I know we decided to use python, but this was
 mostly for me to help me get trough the output, and writing it in python
 would take much longer. I just put it there if someone else in future
 finds it useful. Despite being a perl, I hope this one is quite readable.
 I guess it's not a problem when this is not for users (and I just couldn't
 resist writing little bit in my favorite language :-P).


 I'd like to merge these patches in master and keep them there for future
 generations. I think this doesn't need a changelog, since it's our tool.

 '''The results'''

 About the output, I went trough it, removed the ones that are caused by
 the tests only (we might want to clean the tests sometime in future too,
 but I think it is low priority now). There are several areas of problems,
 I'm not sure what causes them yet:
  * The ZoneEntryTest.AddressSelection (NSAS) test fails. It seems to have
 something to do with selection of random numbers. Is it possible that
 valgrind replaces rand or something like that? But I would suggest we
 ignore this one.
  * Many things in NSAS seem to leak. Maybe it's because the events are not
 delivered to them (AFAIK some stuff in there is freed when either an
 answer or timeout comes, which is possible we don't do in the test), maybe
 it's something more. This is by far the longest part of output, but its
 relatively repeated.
  * Asiolink might have a leak in DNSService (but I guess it's only a
 DNSService is created and not freed, actually), and in
 RecursiveQuery::resolve.
  * Cache seems to drop MessageEntry objects sometimes.
  * Some minor/less visible problems with the rest (invalid read inside
 freed memory in cc tests, probably caused by tests, open with NULL
 filename in dns library tests, IOEndpoint leak in auth tests).

 May I create tickets for each of these tasks (except the
 AddressSelection)? I would the output as attachment for each of them.

 Thanks

-- 
Ticket URL: <https://bind10.isc.org/ticket/614#comment:3>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list