summaryrefslogtreecommitdiff
path: root/test/test-curve.test
blob: cce049c510babd380a61a03be679c11f64d4f578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

# Driver for curve tester
#
# Copyright 2018 Robert Krawitz (rlk@alum.mit.edu)
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

if [[ -n "$STP_TEST_LOG_PREFIX" ]] ; then
    redir="${STP_TEST_LOG_PREFIX}${0##*/}_$$.log"
    if [[ -n $BUILD_VERBOSE ]] ; then
	exec > >(tee -a "$redir" >&3)
    else
	exec 1>>"$redir"
    fi
    exec 2>&1
fi
set -e

retval=0

if [[ -z $srcdir || $srcdir = . ]] ; then
    sdir=$(pwd)
elif [[ $srcdir =~ ^/ ]] ; then
    sdir="$srcdir"
else
    sdir="$(pwd)/$srcdir"
fi

export STP_DATA_PATH=${STP_DATA_PATH:-"$sdir/../src/xml"}
export STP_MODULE_PATH=${STP_MODULE_PATH:-"$sdir/../src/main:$sdir/../src/main/.libs"}

declare valgrind=0

function runit() {
    echo "================================================================"
    echo "$@"
    [[ -z $STP_TEST_DEBUG ]] && "$@"
}

case "$STP_TEST_PROFILE" in
    valgrind*)
	vg="libtool --mode=execute valgrind"
	valgrind="$vg --num-callers=50 --leak-check=yes --error-limit=no --error-exitcode=1"
	;;
    *)
	valgrind=
	;;
esac

runit $valgrind ./curve