File: runtest

package info (click to toggle)
libbuffy 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 3,796 kB
  • ctags: 380
  • sloc: sh: 8,946; cpp: 2,636; makefile: 75
file content (48 lines) | stat: -rwxr-xr-x 980 bytes parent folder | download | duplicates (2)
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
#!/bin/sh -e

TOP_SRCDIR=`pwd`/`dirname $0`/..

CMD=`pwd`/"$1"

## Set up the test environment

TESTDIR="`mktemp -d`"
cd "$TESTDIR"

tar -C "$TOP_SRCDIR/tests" --mode=ug+w -cf - maildir mbox mboxgz test-config.txt | tar -C "$TESTDIR" -xf -

## Clean up the test environment at exit unless asked otherwise
cleanup() {
	test -z "$PRESERVE" && rm -r "$TESTDIR"
}
trap cleanup EXIT

## Run the tests

#id=`date +%y%m%d%H%M%S`
#$DEBUGGER $BIN $ARGS 2>&1 | tee `pwd`/testrun-$id
#echo Output saved in `pwd`/testrun-$id

# Try to debug the libtool executable, if present
DIR=`dirname $CMD`
BASE=`basename $CMD`
if [ ! -z "$DEBUGGER" ] && [ -x $DIR/.libs/lt-$BASE ]
then
	echo "Running $DEBUGGER $DIR/.libs/lt-$BASE $ARGS"
	$DEBUGGER $DIR/.libs/lt-$BASE $ARGS
	RES=$?
else
	echo "Running $DEBUGGER $CMD $ARGS"
	$DEBUGGER $CMD $ARGS
	RES=$?
fi


if [ ! -z "$PAUSE" ]
then
	echo "Post-test inspection requested."
	echo "Exit this shell to cleanup the test environment."
	bash
fi

exit $RES