Refactored common parts into test_prologue.sh and test_bulk.sh.
[gedcom-parse.git] / t / src / test_prologue.sh
diff --git a/t/src/test_prologue.sh b/t/src/test_prologue.sh
new file mode 100644 (file)
index 0000000..dfbdb4d
--- /dev/null
@@ -0,0 +1,50 @@
+# $Id$
+# $Name$
+# Common prologue for the test scripts
+
+extra_options=
+
+while [ $# -gt 0 ]
+do
+  case "$1" in
+    -*) extra_options="$extra_options $1";;
+    *)  break;;
+  esac
+  shift
+done
+
+test_name=$1
+shift
+expected_result=$1
+shift
+if [ -z "$test_name" ]
+then
+  test_name=check
+fi
+if [ -z "$expected_result" ]
+then
+  expected_result=0
+fi
+
+# For use outside Makefile
+if [ -z "$srcdir" ]
+then
+  :
+else
+  options="-q $extra_options"
+fi
+
+outfile=$test_name.out
+logfile=check.out
+reffile=$srcdir/output/$test_name.ref
+options="$options -o $outfile"
+
+GCONV_PATH=.:$GCONV_PATH
+export GCONV_PATH
+LANG=C
+export LANG
+ln -s $srcdir/../data/gedcom.enc .
+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