dotest.sh 866 Bytes
Newer Older
1
#!/bin/sh
2
(cd ..; make mxmldoc-static)
3

Michael R Sweet's avatar
Michael R Sweet committed
4 5 6 7 8 9 10 11
files=""
mode=""

while test $# -gt 0; do
	arg="$1"
	shift

	case "$arg" in
Michael R Sweet's avatar
Michael R Sweet committed
12
		-f) framed="--framed framed" ;;
Michael R Sweet's avatar
Michael R Sweet committed
13 14 15 16
		-g) mode="gdb" ;;
		-v) mode="valgrind" ;;
		*.h | *.c | *.cxx) files="$files $arg" ;;
		*)
17
			echo "Usage: ./dotest.sh [-f] [-g] [-v] [files]"
Michael R Sweet's avatar
Michael R Sweet committed
18 19 20 21 22 23
			exit 1
			;;
	esac
done

if test "$files" = ""; then
24 25 26 27
	files=*.cxx
fi

rm -f test.xml
Michael R Sweet's avatar
Michael R Sweet committed
28 29 30

case "$mode" in
	gdb)
31 32 33
		echo "break malloc_error_break" >.gdbcmds
		echo "set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib" >>.gdbcmds
		echo "run $framed test.xml $files >test.html 2>test.log" >>.gdbcmds
Michael R Sweet's avatar
Michael R Sweet committed
34 35 36 37 38
		gdb -x .gdbcmds ../mxmldoc-static
		;;

	valgrind)
		valgrind --log-fd=3 --leak-check=yes \
Michael R Sweet's avatar
Michael R Sweet committed
39
			../mxmldoc-static $framed test.xml $files \
Michael R Sweet's avatar
Michael R Sweet committed
40 41 42 43
			>test.html 2>test.log 3>test.valgrind
		;;

	*)
Michael R Sweet's avatar
Michael R Sweet committed
44
		../mxmldoc-static $framed test.xml $files >test.html 2>test.log
Michael R Sweet's avatar
Michael R Sweet committed
45 46
		;;
esac
47