| 1 |
#!@BASHREAL@ |
| 2 |
|
| 3 |
# Driver for curve tester |
| 4 |
# |
| 5 |
# Copyright 2018 Robert Krawitz ([email protected]) |
| 6 |
# |
| 7 |
# This program is free software; you can redistribute it and/or modify it |
| 8 |
# under the terms of the GNU General Public License as published by the Free |
| 9 |
# Software Foundation; either version 2 of the License, or (at your option) |
| 10 |
# any later version. |
| 11 |
# |
| 12 |
# This program is distributed in the hope that it will be useful, but |
| 13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 |
# for more details. |
| 16 |
# |
| 17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
if [[ -n "$STP_TEST_LOG_PREFIX" ]] ; then |
| 21 |
redir="${STP_TEST_LOG_PREFIX}${0##*/}_$$.log" |
| 22 |
if [[ -n $BUILD_VERBOSE ]] ; then |
| 23 |
exec > >(tee -a "$redir" >&3) |
| 24 |
else |
| 25 |
exec 1>>"$redir" |
| 26 |
fi |
| 27 |
exec 2>&1 |
| 28 |
fi |
| 29 |
set -e |
| 30 |
|
| 31 |
retval=0 |
| 32 |
|
| 33 |
if [[ -z $srcdir || $srcdir = . ]] ; then |
| 34 |
sdir=$(pwd) |
| 35 |
elif [[ $srcdir =~ ^/ ]] ; then |
| 36 |
sdir="$srcdir" |
| 37 |
else |
| 38 |
sdir="$(pwd)/$srcdir" |
| 39 |
fi |
| 40 |
|
| 41 |
export STP_DATA_PATH=${STP_DATA_PATH:-"$sdir/../src/xml"} |
| 42 |
export STP_MODULE_PATH=${STP_MODULE_PATH:-"$sdir/../src/main:$sdir/../src/main/.libs"} |
| 43 |
|
| 44 |
declare valgrind=0 |
| 45 |
|
| 46 |
function runit() { |
| 47 |
echo "================================================================" |
| 48 |
echo "$@" |
| 49 |
[[ -z $STP_TEST_DEBUG ]] && "$@" |
| 50 |
} |
| 51 |
|
| 52 |
case "$STP_TEST_PROFILE" in |
| 53 |
valgrind*) |
| 54 |
vg="libtool --mode=execute valgrind" |
| 55 |
valgrind="$vg --num-callers=50 --leak-check=yes --error-limit=no --error-exitcode=1" |
| 56 |
;; |
| 57 |
*) |
| 58 |
valgrind= |
| 59 |
;; |
| 60 |
esac |
| 61 |
|
| 62 |
runit $valgrind ./curve |