<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>Hi,<br></div>
<div><br></div>
<div>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.<br></div>
<div><br></div>
<div>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?<br></div>
<div><br></div>
<div>Example usage of ctest:<br></div>
<div><br></div>
<div>ctest -D ExperimentalMemCheck<br></div>
<div><br></div>
<div>With MEMORYCHECK_OPTIONS = "--error-exitcode=1 --leak-check=full"<br></div>
<div><br></div>
<div>Thanks,<br></div>
<div>Shane</div>
</body>
</html>