From 7f4cc09821c72aff7188171e3461c8c7ba4d3988 Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Sun, 28 Jul 2013 12:04:03 +0000 Subject: [PATCH] 6951: import/export test suite runner broken Revived the runner broken as of 3.0.0. Notable changes: 1) instead of GRDB, using a named 'example' DB in a dedicated GRAMPSHOME location 2) changed the format list to the more modern one 3) produced GRAMPS XML created manually from .gramps with gunzip 4) action "summary" no longer there, using the textual "summary" report svn: r22744 --- test/impex.sh | 56 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/test/impex.sh b/test/impex.sh index 4848c20ad..014ac340c 100755 --- a/test/impex.sh +++ b/test/impex.sh @@ -1,8 +1,8 @@ #! /bin/sh # # Import/export test for GRAMPS: -# o Import example XML data and create GRDB -# o Open produced GRDB, then +# o Import example XML data and create internal Gramps DB +# o Open produced Gramps DB, then # * check data for integrity # * output in all formats # o Check resulting XML for well-formedness and validate it @@ -17,54 +17,74 @@ SRC_DIR=$TOP_DIR/src PRG="python gramps.py" EXAMPLE_XML=$TOP_DIR/example/gramps/example.gramps -OUT_FMT="gedcom gramps-xml gramps-pkg wft geneweb" -IN_FMT="gedcom gramps-xml gramps-pkg" +OUT_FMT="csv ged gramps gpkg wft gw vcs vcf" +IN_FMT="ged gramps gpkg" DATA_DIR=$TEST_DIR/data mkdir -p $DATA_DIR -if [ -f $DATA_DIR/example.grdb ]; then - rm $DATA_DIR/example.grdb +GRAMPSHOME=$DATA_DIR/grampshome +export GRAMPSHOME +echo "" +echo "+--------------------------------------------------------------" +echo "| GRAMPSHOME set to: $GRAMPSHOME " +echo "+--------------------------------------------------------------" + +if [ -d $GRAMPSHOME/. ]; then + rm -rf $GRAMPSHOME fi echo "" echo "+--------------------------------------------------------------" -echo "| Import XML, write GRDB" +echo "| Import XML, create Gramps DB 'example'" echo "+--------------------------------------------------------------" -OPTS="-i $EXAMPLE_XML -o $DATA_DIR/example.grdb" +OPTS="-i $EXAMPLE_XML -C example" (cd $SRC_DIR; $PRG $OPTS) echo "" echo "+--------------------------------------------------------------" -echo "| Check GRDB for errors" +echo "| Check the example DB for errors" 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) echo "" echo "+--------------------------------------------------------------" -echo "| Open GRDB, write all other formats" +echo "| Open the example DB, write all other formats" echo "+--------------------------------------------------------------" -OPTS="-O $DATA_DIR/example.grdb" +OPTS="-O example" 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 -(cd $SRC_DIR; $PRG $OPTS) +(cd $SRC_DIR; echo "$PRG $OPTS"; $PRG $OPTS) echo "" echo "+--------------------------------------------------------------" echo "| Validate produced XML" 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" -xmllint --noout --valid $DATA_DIR/example.gramps-xml +xmllint --noout --valid $RESULT_XML echo "* Post-parsing DTD validation" -xmllint --noout --postvalid $DATA_DIR/example.gramps-xml +xmllint --noout --postvalid $RESULT_XML 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 "| Import all produced files and print summary" echo "+--------------------------------------------------------------" for fmt in $IN_FMT; do - OPTS="-i $DATA_DIR/example.$fmt -f $fmt -a summary" + 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) + cat $REPORT_TXT done