Browse Source

[trac614] Functional fixes

* Don't fail on test crash
* Better escaping of IPC in the script
* Run from the tests' dir, so they find their files
Michal 'vorner' Vaner 14 years ago
parent
commit
923a470796
1 changed files with 8 additions and 4 deletions
  1. 8 4
      tools/tests_in_valgrind.sh

+ 8 - 4
tools/tests_in_valgrind.sh

@@ -10,11 +10,11 @@ if [ $? = 2 ] ; then
     exit 1
     exit 1
 fi
 fi
 
 
-set -ex
+set -e
 
 
 # Some configuration
 # Some configuration
 # TODO Escape for sed, this might break
 # TODO Escape for sed, this might break
-LOGFILE="${VALGRIND_FILE:-valgrind.log}"
+LOGFILE="${VALGRIND_FILE:-`pwd`/valgrind.log}"
 FLAGS="${VALGRIND_FLAGS:---read-var-info=yes --leak-check=full}"
 FLAGS="${VALGRIND_FLAGS:---read-var-info=yes --leak-check=full}"
 FLAGS="$FLAGS --log-file=$LOGFILE.%p"
 FLAGS="$FLAGS --log-file=$LOGFILE.%p"
 
 
@@ -28,13 +28,17 @@ eval $(find . -type f -executable -name run_unittests -print | grep -v '\.libs/r
     chmod +x "$testname.valgrind"
     chmod +x "$testname.valgrind"
     echo "$testname" >>"$LOGFILE"
     echo "$testname" >>"$LOGFILE"
     echo "===============" >>"$LOGFILE"
     echo "===============" >>"$LOGFILE"
-    "$testname.valgrind" >&2 &
+    pushd $(dirname "$testname") >/dev/null
+    "./run_unittests.valgrind" >&2 &
     PID="$!"
     PID="$!"
+    set +e
     wait "$PID"
     wait "$PID"
     CODE="$?"
     CODE="$?"
+    set -e
+    popd >/dev/null
     if [ "$CODE" != 0 ] ; then
     if [ "$CODE" != 0 ] ; then
         echo 'FAILED="$FAILED
         echo 'FAILED="$FAILED
-'"'$testname'"
+'"$testname"'"'
     fi
     fi
     NAME="$LOGFILE.$PID"
     NAME="$LOGFILE.$PID"
     rm "$testname.valgrind"
     rm "$testname.valgrind"