Small correction in help string.
[gedcom-parse.git] / t / src / test_update
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 test_name=$1
18 expected_result=$2
19 if [ -z "$test_name" ]
20 then
21   test_name=check
22 fi
23 if [ -z "$expected_result" ]
24 then
25   expected_result=0
26 fi
27
28 # For use outside Makefile
29 if [ -z "$srcdir" ]
30 then
31   srcdir=.
32   options=$extra_options
33 else
34   options="$options $extra_options"
35 fi
36
37 outfile=$test_name.out
38 logfile=check.out
39 reffile=$srcdir/output/$test_name.ref
40 options="$options -o $outfile"
41
42 builddir=`pwd`
43 ltcmd="$builddir/../libtool --mode=execute -dlopen $builddir/../gedcom/libgedcom.la"
44 GCONV_PATH=.:$GCONV_PATH
45 export GCONV_PATH
46 ln -s $srcdir/../data/gedcom.enc .
47 ln -s $builddir/../data/new.ged .
48 ln -s $builddir/../iconv/glibc/.libs/ANSI_Z39.47.so .
49 ln -s $srcdir/../iconv/glibc/gconv-modules .
50 rm -f core
51 echo "======================================================">> $logfile
52 echo "Performing test '$test_name'" >> $logfile
53 $ltcmd $GEDCOM_TESTENV $builddir/src/updatetest $options
54 result=$?
55 rm gedcom.enc
56 rm new.ged
57 rm ANSI_Z39.47.so
58 rm gconv-modules
59
60 echo "Result is $result (expected: $expected_result)" >> $logfile
61 if [ "$result" -ne "$expected_result" ]
62 then
63   echo "Not the expected return value!" >> $logfile
64   exit 1
65 else
66   if [ -r core ]
67   then
68     echo "Core file generated!" >> $logfile
69     exit 1
70   else
71     if diff $outfile $reffile >/dev/null 2>>$logfile
72     then
73       echo "Output agrees with reference output" >> $logfile
74       rm $outfile
75       exit 0
76     else
77       echo "Differences with reference output detected!" >> $logfile
78       exit 1
79     fi
80   fi
81 fi