tests: Fix valgrind reporting some false positives

Because of the design of gcc's std::string (its pointer does not point
to the beginning of the allocated memory block, but somewhere inside it)
memcheck reports false memory leaks when program exists with some
strings still existing. New versions of memcheck (>= 3.9.0) have some
heuristics which make it possible to detect that memory allocated for
a reachable std::string is still reachable. To enable this heuristics
one have to pass the --leak-check-heuristics flag. This commit modifies
the testing framework to use this flag if available.

Change-Id: Ib2e09273a87331e7861bdf7638298f0f6c78fb63