pyflame icon indicating copy to clipboard operation
pyflame copied to clipboard

Add Memory Safety Tests

Open eklitzke opened this issue 8 years ago • 1 comments

I occasionally run Pyflame through valgrind, and it always gets a completely clean report. However, I'd like to test this more rigorously. Things I'd like to see:

  • [ ] Add tests that check that valgrind --tool=memcheck on Pyflame returns a clean output report
  • [ ] Add ASAN tests that build Pyflame with ASAN and make sure no errors are reported
  • [ ] Add tcmalloc heap checker tests (although I think the above two checks should really be sufficient)

I'd kind of like to write this as a separate library/framework, since I've wanted to do these kinds of tests with other C++ programs I've written. These should be written in a way that they're optional, so the tests will only run if the tools are actually available on the system. And of course, the Travis job should run the full suite of memory checking tests.

eklitzke avatar Aug 08 '17 20:08 eklitzke

For Vaglrind, it looks like you can fork the Valgrind process and give it --xml=yes and --xml-fd=FD where FD is a file descriptor you allocate using pipe(2). This will allow getting the Valgrind output on its own channel without using a temporary file.

eklitzke avatar Aug 08 '17 20:08 eklitzke