6951: import/export test suite runner broken
Reapply the fix from gramps40. svn: r22747
This commit is contained in:
parent
61700431e6
commit
93c999dcb0
@ -1,70 +1,102 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
#
|
#
|
||||||
# Import/export test for GRAMPS:
|
# Import/export test for GRAMPS:
|
||||||
# o Import example XML data and create GRDB
|
# o Import example XML data and create internal Gramps DB
|
||||||
# o Open produced GRDB, then
|
# o Open produced example Gramps DB, then
|
||||||
# * check data for integrity
|
# * check data for integrity
|
||||||
# * output in all formats
|
# * output in all formats
|
||||||
# o Check resulting XML for well-formedness and validate it
|
# o Check resulting XML for well-formedness and validate it
|
||||||
# against DTD and RelaxNG schema.
|
# against DTD and RelaxNG schema.
|
||||||
# o Import ever file produced and run summary on it.
|
# o Import every exported file produced if the format
|
||||||
|
# is also supported for import, and run a text summary report.
|
||||||
|
# o Diff each report with the summary of the produced example DB
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
TOP_DIR=`dirname $PWD`
|
TOP_DIR=`dirname $PWD`
|
||||||
TEST_DIR=$TOP_DIR/test
|
TEST_DIR=$TOP_DIR/test
|
||||||
SRC_DIR=$TOP_DIR/src
|
SRC_DIR=$TOP_DIR/gramps
|
||||||
PRG="python gramps.py"
|
PRG="python ../Gramps.py"
|
||||||
EXAMPLE_XML=$TOP_DIR/example/gramps/example.gramps
|
EXAMPLE_XML=$TOP_DIR/example/gramps/example.gramps
|
||||||
|
|
||||||
OUT_FMT="gedcom gramps-xml gramps-pkg wft geneweb"
|
OUT_FMT="csv ged gramps gpkg wft gw vcs vcf"
|
||||||
IN_FMT="gedcom gramps-xml gramps-pkg"
|
IN_FMT="csv ged gramps gpkg gw vcf"
|
||||||
DATA_DIR=$TEST_DIR/data
|
DATA_DIR=$TEST_DIR/data
|
||||||
mkdir -p $DATA_DIR
|
mkdir -p $DATA_DIR
|
||||||
if [ -f $DATA_DIR/example.grdb ]; then
|
GRAMPSHOME=$DATA_DIR/grampshome
|
||||||
rm $DATA_DIR/example.grdb
|
export GRAMPSHOME
|
||||||
|
echo ""
|
||||||
|
echo "+--------------------------------------------------------------"
|
||||||
|
echo "| GRAMPSHOME set to: $GRAMPSHOME "
|
||||||
|
echo "+--------------------------------------------------------------"
|
||||||
|
|
||||||
|
if [ -d $GRAMPSHOME/. ]; then
|
||||||
|
rm -rf $GRAMPSHOME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
echo "| Import XML, write GRDB"
|
echo "| Import XML, create Gramps DB 'example'"
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
OPTS="-i $EXAMPLE_XML -o $DATA_DIR/example.grdb"
|
OPTS="-i $EXAMPLE_XML -C example"
|
||||||
(cd $SRC_DIR; $PRG $OPTS)
|
(cd $SRC_DIR; $PRG $OPTS)
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
echo "| Check GRDB for errors"
|
echo "| Check the example DB for errors"
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
OPTS="-O $DATA_DIR/example.grdb -a tool -p name=check"
|
OPTS="-O example -a tool -p name=check"
|
||||||
(cd $SRC_DIR; $PRG $OPTS)
|
(cd $SRC_DIR; $PRG $OPTS)
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
echo "| Open GRDB, write all other formats"
|
echo "| Open the example DB, write all other formats"
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
OPTS="-O $DATA_DIR/example.grdb"
|
OPTS="-O example"
|
||||||
for fmt in $OUT_FMT; do
|
for fmt in $OUT_FMT; do
|
||||||
OPTS="$OPTS -o $DATA_DIR/example.$fmt -f $fmt"
|
OPTS="$OPTS -e $DATA_DIR/example.$fmt -f $fmt"
|
||||||
done
|
done
|
||||||
(cd $SRC_DIR; $PRG $OPTS)
|
(cd $SRC_DIR; echo "$PRG $OPTS"; $PRG $OPTS)
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
echo "| Validate produced XML"
|
echo "| Validate produced XML"
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
|
RESULT_GRAMPS=$DATA_DIR/example.gramps
|
||||||
|
if [ -f $RESULT_GRAMPS ]; then
|
||||||
|
RESULT_XML=$DATA_DIR/example.xml
|
||||||
|
gunzip < $RESULT_GRAMPS > $RESULT_XML
|
||||||
|
else
|
||||||
|
echo "+--------------------------------------------------------------"
|
||||||
|
echo "| ERROR: $RESULT_GRAMPS not found"
|
||||||
|
echo "+--------------------------------------------------------------"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "* Regular well-formedness and DTD validation"
|
echo "* Regular well-formedness and DTD validation"
|
||||||
xmllint --noout --valid $DATA_DIR/example.gramps-xml
|
xmllint --noout --valid $RESULT_XML
|
||||||
echo "* Post-parsing DTD validation"
|
echo "* Post-parsing DTD validation"
|
||||||
xmllint --noout --postvalid $DATA_DIR/example.gramps-xml
|
xmllint --noout --postvalid $RESULT_XML
|
||||||
echo "* Validate against RelaxNG schema"
|
echo "* Validate against RelaxNG schema"
|
||||||
xmllint --noout --relaxng $TOP_DIR/doc/grampsxml.rng $DATA_DIR/example.gramps-xml
|
xmllint --noout --relaxng $TOP_DIR/data/grampsxml.rng $RESULT_XML
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "+----------------------------------------------------------------"
|
||||||
|
echo "| For each produced format supported for import, generate summary"
|
||||||
|
echo "+----------------------------------------------------------------"
|
||||||
|
for fmt in $IN_FMT; do
|
||||||
|
EXPORTED_DATA=$DATA_DIR/example.$fmt
|
||||||
|
REPORT_TXT=$EXPORTED_DATA.report.txt
|
||||||
|
OPTS="-i $EXPORTED_DATA -f $fmt -a report -p name=summary,off=txt,of=$REPORT_TXT"
|
||||||
|
(cd $SRC_DIR; $PRG $OPTS)
|
||||||
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
echo "| Import all produced files and print summary"
|
echo "| Compare to the summary of the original database"
|
||||||
echo "+--------------------------------------------------------------"
|
echo "+--------------------------------------------------------------"
|
||||||
for fmt in $IN_FMT; do
|
IMPORTED_REPORT_TXT=$DATA_DIR/example.report.txt
|
||||||
OPTS="-i $DATA_DIR/example.$fmt -f $fmt -a summary"
|
OPTS="-O example -a report -p name=summary,off=txt,of=$IMPORTED_REPORT_TXT"
|
||||||
(cd $SRC_DIR; $PRG $OPTS)
|
(cd $SRC_DIR; $PRG $OPTS)
|
||||||
|
for exported_report_txt in $DATA_DIR/example.*.report.txt; do
|
||||||
|
diff -u $IMPORTED_REPORT_TXT $exported_report_txt
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user