dd0d0969cfd16fa23d469961074e8c74a2456ea7
[gedcom-parse.git] / t / test_gom
1 #!/bin/sh
2 # $Id$
3 # $Name$
4
5 options="-q"
6 extra_options=
7 dmalloc=`which dmalloc`
8
9 while [ $# -gt 0 ]
10 do
11   case "$1" in
12     -*) extra_options="$extra_options $1";;
13     *)  break;;
14   esac
15   shift
16 done
17
18 file=$1
19 expected_result=$2
20 if [ -z "$expected_result" ]
21 then
22   expected_result=0
23 fi
24
25 # For use outside Makefile
26 if [ -z "$srcdir" ]
27 then
28   testfile=$file
29   srcdir=.
30   options=$extra_options
31 else
32   testfile=input/$file
33   options="$options $extra_options"
34 fi
35
36 builddir=`pwd`
37 export GCONV_PATH=../ansel:$GCONV_PATH
38 export LD_LIBRARY_PATH=$builddir/../gedcom/.libs:$builddir/../gom/.libs:$LD_LIBRARY_PATH
39 cp $builddir/../ansel/.libs/ANSI_Z39.47.so ../ansel
40 rm -f core
41 if [ "$GOM_DMALLOC_TEST" = "" ]
42 then
43   $builddir/gomtest $options $testfile
44 else
45   $dmalloc -b -l dmalloc.log -i 100 low > dmalloc.env
46   . dmalloc.env
47   rm dmalloc.env
48   $builddir/gomtest_static $options $testfile
49 fi
50 result=$?
51 rm ../ansel/ANSI_Z39.47.so
52 if [ "$result" -eq "$expected_result" -a ! -r core ]
53 then
54   exit 0
55 else
56   exit 1
57 fi