X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=t%2Fsrc%2Ftest_gom;h=7cfd657c893d723105c96c262fa9ec80809c2233;hb=a5bd4c3c89f5cb433a615c436947b8b0f44c3661;hp=fdb849f03932e8e30d81bd1c599b4ed5179a0a92;hpb=40b99549ec69cb65fc3b979c6383bed5b88af7f4;p=gedcom-parse.git diff --git a/t/src/test_gom b/t/src/test_gom index fdb849f..7cfd657 100755 --- a/t/src/test_gom +++ b/t/src/test_gom @@ -4,8 +4,6 @@ options="-q" extra_options= -dmalloc=`which dmalloc` -dmalloc_tmp=dmalloc.env while [ $# -gt 0 ] do @@ -17,7 +15,12 @@ do done file=$1 -expected_result=$2 +test_name=$2 +expected_result=$3 +if [ -z "$test_name" ] +then + test_name=check +fi if [ -z "$expected_result" ] then expected_result=0 @@ -34,29 +37,46 @@ 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:$builddir/../gom/.libs:$LD_LIBRARY_PATH +ltcmd="$builddir/../libtool --mode=execute -dlopen $builddir/../gedcom/libgedcom.la -dlopen $builddir/../gom/libgedcom_gom.la" +GCONV_PATH=.:$GCONV_PATH +export GCONV_PATH ln -s $srcdir/../data/gedcom.enc . -ln -s $builddir/../ansel/.libs/ANSI_Z39.47.so . -ln -s $srcdir/../ansel/gconv-modules . +ln -s $builddir/../iconv/glibc/.libs/ANSI_Z39.47.so . +ln -s $srcdir/../iconv/glibc/gconv-modules . rm -f core -if [ "$GOM_DMALLOC_TEST" = "" ] -then - $GEDCOM_TESTENV $builddir/src/gomtest $options $testfile -else - $dmalloc -b -l $GOM_DMALLOC_TEST -i 100 low > $dmalloc_tmp - . $dmalloc_tmp - rm $dmalloc_tmp - $GEDCOM_TESTENV $builddir/src/gomtest_static $options $testfile -fi +echo "======================================================">> $logfile +echo "Performing test '$test_name'" >> $logfile +$ltcmd $GEDCOM_TESTENV $builddir/src/gomtest $options $testfile result=$? rm gedcom.enc 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