X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=t%2Fsrc%2Ftest_update;h=113f6fe3dfd86f6bad29c748229d76a9e31201a2;hb=d7e1e0c33172af1165d3059f67d51ec099fa4e02;hp=7393494d826207ebdc73f19bd2d44c23e341403e;hpb=63b6a314939f40a868b3589dcf47ae30cfac0395;p=gedcom-parse.git diff --git a/t/src/test_update b/t/src/test_update index 7393494..113f6fe 100755 --- a/t/src/test_update +++ b/t/src/test_update @@ -14,7 +14,12 @@ do shift done -expected_result=$1 +test_name=$1 +expected_result=$2 +if [ -z "$test_name" ] +then + test_name=check +fi if [ -z "$expected_result" ] then expected_result=0 @@ -29,23 +34,48 @@ else options="$options $extra_options" fi +outfile=$test_name.out +logfile=check.out +reffile=$srcdir/output/$test_name.ref +options="$options -o $outfile" + builddir=`pwd` -export GCONV_PATH=.:$GCONV_PATH -export LD_LIBRARY_PATH=$builddir/../gedcom/.libs:$LD_LIBRARY_PATH +ltcmd="$builddir/../libtool --mode=execute -dlopen $builddir/../gedcom/libgedcom.la" +GCONV_PATH=.:$GCONV_PATH +export GCONV_PATH ln -s $srcdir/../data/gedcom.enc . -ln -s $srcdir/../data/new.ged . -ln -s $builddir/../ansel/.libs/ANSI_Z39.47.so . -ln -s $srcdir/../ansel/gconv-modules . +ln -s $builddir/../data/new.ged . +ln -s $builddir/../iconv/glibc/.libs/ANSI_Z39.47.so . +ln -s $srcdir/../iconv/glibc/gconv-modules . rm -f core -$GEDCOM_TESTENV $builddir/src/updatetest $options +echo "======================================================">> $logfile +echo "Performing test '$test_name'" >> $logfile +$ltcmd $GEDCOM_TESTENV $builddir/src/updatetest $options result=$? rm gedcom.enc rm new.ged rm ANSI_Z39.47.so rm gconv-modules -if [ "$result" -eq "$expected_result" -a ! -r core ] + +echo "Result is $result (expected: $expected_result)" >> $logfile +if [ "$result" -ne "$expected_result" ] then - exit 0 -else + echo "Not the expected return value!" >> $logfile exit 1 +else + if [ -r core ] + then + echo "Core file generated!" >> $logfile + exit 1 + else + if diff $outfile $reffile >/dev/null 2>>$logfile + then + echo "Output agrees with reference output" >> $logfile + rm $outfile + exit 0 + else + echo "Differences with reference output detected!" >> $logfile + exit 1 + fi + fi fi