-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtest.sh
executable file
·49 lines (39 loc) · 1010 Bytes
/
runtest.sh
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
#! /bin/sh
# Collect stdout/stderr someplace else
if [ ! -d testresults ]; then
mkdir -p testresults
fi
SRCDIR=`dirname $0`
case "$SRCDIR" in
/*) ;; # already absolute, groovy!
*) SRCDIR="`pwd`/$SRCDIR" ;;
esac
export SRCDIR
SYSTEMTAP_TAPSET=$SRCDIR/tapset
export SYSTEMTAP_TAPSET
SYSTEMTAP_RUNTIME=$SRCDIR/runtime
export SYSTEMTAP_RUNTIME
if [ -d lib-elfutils ]; then
lib_elfutils="`pwd`/lib-elfutils"
elfutils_path="${lib_elfutils}:${lib_elfutils}/systemtap"
LD_LIBRARY_PATH="${elfutils_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
fi
dn=`dirname $1`
logfile=testresults/`basename $dn`-`basename $1`
env | grep SYSTEMTAP > $logfile.cmd
echo "$*" >> $logfile.cmd
# This is proper quoting to let multiword arguments through (for e.g. -e).
"$@" >$logfile.out 2>$logfile.err
rc=$?
echo "rc=$rc" > $logfile.rc
if expr $1 : '.*ok/.*' >/dev/null; then
if [ $rc -eq 0 ]; then
rm -f $logfile.*
fi
else
if [ $rc -eq 1 ]; then
rm -f $logfile.*
fi
fi
exit $rc