summaryrefslogtreecommitdiff
path: root/lemon/scripts/valgrind-wrapper.sh
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-07-10 13:44:21 +1000
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-07-10 13:44:21 +1000
commitef4a319984d22b88a9024ff523700d657621124d (patch)
tree2821db78ccd6ce61ca64ad6fc98ba825b060ca6a /lemon/scripts/valgrind-wrapper.sh
parentd3f13fdd23e17a8f4bb4083c24fee331a28351eb (diff)
Add the LEMON graph library source to the repo
I'll likely be using it, so this just makes it easier to get to from elsewhere. If I end up not using it then I can just delete it.
Diffstat (limited to 'lemon/scripts/valgrind-wrapper.sh')
-rwxr-xr-xlemon/scripts/valgrind-wrapper.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/lemon/scripts/valgrind-wrapper.sh b/lemon/scripts/valgrind-wrapper.sh
new file mode 100755
index 0000000..bbb1222
--- /dev/null
+++ b/lemon/scripts/valgrind-wrapper.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Run in valgrind, with leak checking enabled
+
+valgrind -q --leak-check=full "$@" 2> .valgrind-log
+
+# Save the test result
+
+result="$?"
+
+# Valgrind should generate no error messages
+
+log_contents="`cat .valgrind-log`"
+
+if [ "$log_contents" != "" ]; then
+ cat .valgrind-log >&2
+ result=1
+fi
+
+rm -f .valgrind-log
+
+exit $result