1#!/bin/sh
2(cd ..; make mxmldoc-static)
3
4files=""
5mode=""
6
7while test $# -gt 0; do
8	arg="$1"
9	shift
10
11	case "$arg" in
12		-f) framed="--framed framed" ;;
13		-g) mode="gdb" ;;
14		-v) mode="valgrind" ;;
15		*.h | *.c | *.cxx) files="$files $arg" ;;
16		*)
17			echo "Usage: ./dotest.sh [-f] [-g] [-v] [files]"
18			exit 1
19			;;
20	esac
21done
22
23if test "$files" = ""; then
24	files=*.cxx
25fi
26
27rm -f test.xml
28
29case "$mode" in
30	gdb)
31		echo "break malloc_error_break" >.gdbcmds
32		echo "set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib" >>.gdbcmds
33		echo "run $framed test.xml $files >test.html 2>test.log" >>.gdbcmds
34		gdb -x .gdbcmds ../mxmldoc-static
35		;;
36
37	valgrind)
38		valgrind --log-fd=3 --leak-check=yes \
39			../mxmldoc-static $framed test.xml $files \
40			>test.html 2>test.log 3>test.valgrind
41		;;
42
43	*)
44		../mxmldoc-static $framed test.xml $files >test.html 2>test.log
45		;;
46esac
47
48