How do I use Valgrind with Squish?

Last edited on

How to use Valgrind with Squish

If you want to do memory leak testing, Valgrind is the best choice if you are on Linux or any other OS it is supported on.

Here is how to use it with Squish:

1. Create a shell script to wrap the AUT invocation

#!/bin/sh
valgrind --log-file=/tmp/valgrind.log /path/to/real/aut

Where "/path/to/real/aut" should be replaced with the path to your application.

2. Make the shell script executable with

chmod +x shellScriptName

3. Try running your shell script to make sure it works.

4. Specify the shell script as AUT.

5. Increase the startup timeout as it will take longer to start.

6. Run your test, and inspect the log file.

The above should work well for memory access errors. You may run into issues with the leak report at the end, however. Valgrind produces a final report, but Squish may kill the process too early. Changing the HardExitTimeout and SoftExitTimeout squishserver settings to large values may help here (see Configuring squisherver ).

The best solution is to explicitly end the application as part of your test script and add a longer snooze() statement at the end to give Valgrind enough time to generate its report.