Quantcast

Ignoring exit code of child process with ctest memcheck run using valgrind

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Ignoring exit code of child process with ctest memcheck run using valgrind

Shane Matley
Hi,

I'm using memcheck in ctest to run valgrind on a test binary which may sometimes return a non-zero exit code. Valgrind will always return the exit code of its child process if it doesn't find any problems. (This occurs even with --error-exitcode=1.) This means that valgrind will return a non-zero exit code if the child process does, which our CI system is interpreting as a valgrind error. I have gotten around this in the past by using either an environment variable or argument to the child process that makes the child process always return 0.

Now that I am using ctest and memcheck instead of calling valgrind explicitly, I'm finding it difficult to set the environment variable or pass an argument to the child process only for memcheck tests. Is there a way of setting an environment variable or adding arguments to a test for just memcheck tests, while not affecting a normal test run?

Example usage of ctest:

ctest -D ExperimentalMemCheck

With MEMORYCHECK_OPTIONS = "--error-exitcode=1 --leak-check=full"

Thanks,
Shane

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...