Valgrind automatic tests — are they used somewhere

2019-04-12 22:23发布

问题:

Do you think that running set of automatic tests based on valgrind's tool suite makes sense? Did you hear about or see such setup in action? What automatic (free from human intuition) actions could such setup perform?

回答1:

This would make sense if you were checking for memory problems / bad code as part of unit testing or final build testing. There may be two approaches:

  1. writing a test tool that will use valgrind's API through its library, pretty much creating a custom front-end replacing the valgrind executable (seems like a headache)
  2. Valgrind can also output XML for memcheck ( the --xml=yes option)
  3. Use Expect http://en.wikipedia.org/wiki/Expect to automate your commandline valgrind actions and inspect the output
  4. Write shell scripts that run valgrind and grep the output
  5. Maybe look into adding this functionality to something like DejaGNU which uses expect and tcl

Maybe these tools could automatically create bug items in your tracker (although it might fill up quickly).

Not seen anything myself, but as a valgrind user, it would be handy. If you create something cool, maybe launch it as an open-source project!

edit after a bit of googling I found http://www.redhat.com/f/summitfiles/presentation/June2/Developer%20Tools/Cox,Malcom_Automated%20Testing.pdf

Which seems to cover automated testing using DejaGNU and Valgrind as I suggested above

Good Luck!