Add support for OpenWRT
[pulga.git] / run-under-valgrind.sh
blob04f6eab1fa478dc1cdd932bcda88e8b5ad035cd0
1 #!/usr/bin/env bash
2 echo "Testing Pulga under Valgrind"
4 # Making sure we're in the directory where this script is contained
5 PRG="$0"
6 while [ -h "$PRG" ] ; do
7 PRG=$(readlink "$PRG")
8 done
10 scriptdir=$(dirname "$PRG")
11 cd $scriptdir
14 if [[ ! -f "./target/release/pulga" ]]; then
15 echo "you need to run \"cargo build --release\" first"
16 exit 1
19 # Run it under Valgrind, fail if Valgrind reports any error
20 valgrind --leak-check=full --error-exitcode=123 ./target/release/pulga
22 if [[ "$?" != '123' ]]; then
23 echo ''
24 echo 'Valgrind did not find any errors'
25 else
26 exit 127