First check-in of gedcom object model.
[gedcom-parse.git] / t / test_script
1 #!/bin/sh
2 # $Id$
3 # $Name$
4
5 options="-q"
6 extra_options=
7
8 while [ $# -gt 0 ]
9 do
10   case "$1" in
11     -*) extra_options="$extra_options $1";;
12     *)  break;;
13   esac
14   shift
15 done
16
17 file=$1
18 expected_result=$2
19 if [ -z "$expected_result" ]
20 then
21   expected_result=0
22 fi
23
24 # For use outside Makefile
25 if [ -z "$srcdir" ]
26 then
27   testfile=$file
28   srcdir=.
29   options=$extra_options
30 else
31   testfile=input/$file
32   options="$options $extra_options"
33 fi
34
35 builddir=`pwd`
36 export GCONV_PATH=../ansel:$GCONV_PATH
37 export LD_LIBRARY_PATH=$builddir/../gedcom/.libs:$LD_LIBRARY_PATH
38 cp $builddir/../ansel/.libs/ANSI_Z39.47.so ../ansel
39 rm -f core
40 $builddir/testgedcom $options $testfile
41 result=$?
42 rm ../ansel/ANSI_Z39.47.so
43 if [ "$result" -eq "$expected_result" -a ! -r core ]
44 then
45   exit 0
46 else
47   exit 1
48 fi