#! /bin/sh
#
# An EXACT driver that runs valgrind and trace child processes
#
#  _________________________________________________________________________
#
#  FAST: Python tools for software testing.
#  Copyright (c) 2008 Sandia Corporation.
#  This software is distributed under the BSD License.
#  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
#  the U.S. Government retains certain rights in this software.
#  For more information, see the FAST README.txt file.
#  _________________________________________________________________________
#
checkpath=`which valgrind 2>&1 | sed 's/\([^ ]*\) .*/\1/'`

if [ "$checkpath" == "valgrind:" ]; then
   #
   # Run without valgrind if valgrind is not available.
   #
   echo "VALGRIND PATH: None"
   $*
else
   echo "VALGRIND PATH: $checkpath"
   valgrind --tool=memcheck  --leak-check=yes --trace-children=yes $*
fi
