valgrind-unit.sh 619 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env sh
  2. UNIT_BINARY="$1"
  3. shift
  4. UNIT_ARGS="$@"
  5. test "x$OBJ" = "x" && OBJ=$PWD
  6. # This mostly replicates the logic in test-exec.sh for running the
  7. # regress tests under valgrind, except that we unconditionally enable
  8. # leak checking because the unit tests should be clean.
  9. VG_LEAK="--leak-check=full"
  10. VG_TEST=$(basename $UNIT_BINARY)
  11. VG_LOG="$OBJ/valgrind-out/${VG_TEST}.%p"
  12. VG_OPTS="--track-origins=yes $VG_LEAK --log-file=${VG_LOG}"
  13. VG_OPTS="$VG_OPTS --trace-children=yes"
  14. VG_PATH="valgrind"
  15. if [ "x$VALGRIND_PATH" != "x" ]; then
  16. VG_PATH="$VALGRIND_PATH"
  17. fi
  18. exec $VG_PATH $VG_OPTS $UNIT_BINARY $UNIT_ARGS