2005-11-24 01:46:39 +05:30
|
|
|
#! /bin/sh
|
2005-11-24 02:45:32 +05:30
|
|
|
#
|
|
|
|
# Import/export test for GRAMPS: Import example XML data and create GRDB,
|
|
|
|
# check data for integrity, output in all formats, check resulting XML for
|
|
|
|
# well-formedness and validate it against DTD and RelaxNG schema.
|
2005-11-24 01:46:39 +05:30
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
TOP_DIR=`dirname $PWD`
|
|
|
|
TEST_DIR=$TOP_DIR/test
|
|
|
|
SRC_DIR=$TOP_DIR/src
|
|
|
|
PRG="python gramps.py"
|
|
|
|
EXAMPLE_XML=$TOP_DIR/example/gramps/example.gramps
|
2005-11-24 02:45:32 +05:30
|
|
|
|
2005-11-24 01:46:39 +05:30
|
|
|
OUT_FMT="gedcom gramps-xml gramps-pkg wft geneweb"
|
2005-11-24 02:45:32 +05:30
|
|
|
DATA_DIR=$TEST_DIR/data
|
|
|
|
mkdir -p $DATA_DIR
|
|
|
|
if [ -f $DATA_DIR/example.grdb ]; then
|
|
|
|
rm $DATA_DIR/example.grdb
|
|
|
|
fi
|
2005-11-24 01:46:39 +05:30
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "+--------------------------------------------------------------"
|
|
|
|
echo "| Import XML, write GRDB"
|
|
|
|
echo "+--------------------------------------------------------------"
|
2005-11-24 02:45:32 +05:30
|
|
|
OPTS="-i $EXAMPLE_XML -o $DATA_DIR/example.grdb"
|
2005-11-24 01:46:39 +05:30
|
|
|
(cd $SRC_DIR; $PRG $OPTS)
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "+--------------------------------------------------------------"
|
|
|
|
echo "| Check GRDB for errors"
|
|
|
|
echo "+--------------------------------------------------------------"
|
2005-11-24 02:45:32 +05:30
|
|
|
OPTS="-O $DATA_DIR/example.grdb -a tool -p name=check"
|
2005-11-24 01:46:39 +05:30
|
|
|
(cd $SRC_DIR; $PRG $OPTS)
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "+--------------------------------------------------------------"
|
|
|
|
echo "| Open GRDB, write all other formats"
|
|
|
|
echo "+--------------------------------------------------------------"
|
2005-11-24 02:45:32 +05:30
|
|
|
OPTS="-O $DATA_DIR/example.grdb"
|
2005-11-24 01:46:39 +05:30
|
|
|
for fmt in $OUT_FMT; do
|
2005-11-24 02:45:32 +05:30
|
|
|
OPTS="$OPTS -o $DATA_DIR/example.$fmt -f $fmt"
|
2005-11-24 01:46:39 +05:30
|
|
|
done
|
|
|
|
(cd $SRC_DIR; $PRG $OPTS)
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "+--------------------------------------------------------------"
|
|
|
|
echo "| Validate produced XML"
|
|
|
|
echo "+--------------------------------------------------------------"
|
|
|
|
echo "* Regular well-formedness and DTD validation"
|
2005-11-24 02:45:32 +05:30
|
|
|
xmllint --noout --valid $DATA_DIR/example.gramps-xml
|
2005-11-24 01:46:39 +05:30
|
|
|
echo "* Post-parsing DTD validation"
|
2005-11-24 02:45:32 +05:30
|
|
|
xmllint --noout --postvalid $DATA_DIR/example.gramps-xml
|
2005-11-24 01:46:39 +05:30
|
|
|
echo "* Validate against RelaxNG schema"
|
2005-11-24 02:45:32 +05:30
|
|
|
xmllint --noout --relaxng $TOP_DIR/doc/grampsxml.rng $DATA_DIR/example.gramps-xml
|