|
From: Nicholas N. <nj...@cs...> - 2005-03-05 01:23:24
|
On Fri, 4 Mar 2005, Stefan Kost wrote: > sorry if this has been answered before ... > I look for a way to integrate valgrind into my unit-test suite. > The unit-tests are written using check (http://check.sf.net). The project > uses the autotools. > Thus 'make check' runns the binaries and scripts listed in the TESTS variable > of the Makefile.am. > > Now it would be nice to run the tests under valgrind, use the macros from > e.g. memcheck.h at the end of each test and make the test fail if there are > leaks. > The problem is that the program is started without valgrind. Which program -- the test framework, or the individual tests? > One hack to solve it would be something like > > if(!RUNNING_ON_VALGRIND) { > char cmd[FILENAME_MAX]; > > sprintf(cmd,"valgrind %s %s",valgrind_opts,argv[0]); > argv[0]=cmd; > execv(cmd, argv); > } > > I've not yet tried it. Anyone a better idea? Commants? It's unclear where that code goes -- in the programs being tested? In the test framework? I also don't really see how it works. I would think that you need to find some way within the test framework to augment the command lines used to run the individual tests, and prefix them with "valgrind ...". N |