svn: r5426
This commit is contained in:
Alex Roitman 2005-11-23 21:15:32 +00:00
parent ccef7e48c0
commit a9b53b1a9f
3 changed files with 43 additions and 23 deletions

2
gramps2/test/.cvsignore Normal file
View File

@ -0,0 +1,2 @@
data
reports

View File

@ -1,4 +1,8 @@
#! /bin/sh #! /bin/sh
#
# 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.
# $Id$ # $Id$
@ -7,30 +11,35 @@ TEST_DIR=$TOP_DIR/test
SRC_DIR=$TOP_DIR/src SRC_DIR=$TOP_DIR/src
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="gedcom gramps-xml gramps-pkg wft geneweb"
DATA_DIR=$TEST_DIR/data
mkdir -p $DATA_DIR
if [ -f $DATA_DIR/example.grdb ]; then
rm $DATA_DIR/example.grdb
fi
echo "" echo ""
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
echo "| Import XML, write GRDB" echo "| Import XML, write GRDB"
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
rm $TEST_DIR/example.grdb OPTS="-i $EXAMPLE_XML -o $DATA_DIR/example.grdb"
OPTS="-i $EXAMPLE_XML -o $TEST_DIR/example.grdb"
(cd $SRC_DIR; $PRG $OPTS) (cd $SRC_DIR; $PRG $OPTS)
echo "" echo ""
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
echo "| Check GRDB for errors" echo "| Check GRDB for errors"
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
OPTS="-O $TEST_DIR/example.grdb -a tool -p name=check" OPTS="-O $DATA_DIR/example.grdb -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 GRDB, write all other formats"
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
OPTS="-O $TEST_DIR/example.grdb" OPTS="-O $DATA_DIR/example.grdb"
for fmt in $OUT_FMT; do for fmt in $OUT_FMT; do
OPTS="$OPTS -o $TEST_DIR/example.$fmt -f $fmt" OPTS="$OPTS -o $DATA_DIR/example.$fmt -f $fmt"
done done
(cd $SRC_DIR; $PRG $OPTS) (cd $SRC_DIR; $PRG $OPTS)
@ -39,8 +48,8 @@ echo "+--------------------------------------------------------------"
echo "| Validate produced XML" echo "| Validate produced XML"
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
echo "* Regular well-formedness and DTD validation" echo "* Regular well-formedness and DTD validation"
xmllint --noout --valid example.gramps-xml xmllint --noout --valid $DATA_DIR/example.gramps-xml
echo "* Post-parsing DTD validation" echo "* Post-parsing DTD validation"
xmllint --noout --postvalid example.gramps-xml xmllint --noout --postvalid $DATA_DIR/example.gramps-xml
echo "* Validate against RelaxNG schema" echo "* Validate against RelaxNG schema"
xmllint --noout --relaxng ../doc/grampsxml.rng example.gramps-xml xmllint --noout --relaxng $TOP_DIR/doc/grampsxml.rng $DATA_DIR/example.gramps-xml

View File

@ -1,11 +1,24 @@
#! /bin/sh #! /bin/sh
#
# Report test for GRAMPS: Generate every report in every format.
#
# The results of this test set depend on what options were used
# previously with the reports, because this test set is not
# specifying all possible options and their combinations.
# Instead, this is a general test for all formats.
# $Id$ # $Id$
GDIR=`dirname $PWD` TOP_DIR=`dirname $PWD`
TDIR=$GDIR/test TEST_DIR=$TOP_DIR/test
OPTS="-i $GDIR/example/gramps/example.gramps -f gramps-xml" SRC_DIR=$TOP_DIR/src
PRG="python gramps.py" PRG="python gramps.py"
EXAMPLE_XML=$TOP_DIR/example/gramps/example.gramps
REP_DIR=$TEST_DIR/reports
mkdir -p $REP_DIR
OPTS="-i $EXAMPLE_XML"
GRPH_FMT="sxw ps pdf svg" GRPH_FMT="sxw ps pdf svg"
TEXT_FMT="sxw pdf kwd abw rtf txt" TEXT_FMT="sxw pdf kwd abw rtf txt"
@ -16,31 +29,27 @@ TEXT_REP="ancestor_report ancestors_report descend_report det_ancestor_report de
# Single run with all graphical reports in all formats # Single run with all graphical reports in all formats
echo "" echo ""
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
echo "| Reports:" echo "| Graphical Reports: "$GRPH_REP
echo "| "$GRPH_REP echo "| Graphical Formats: "$GRPH_FMT
echo "| Formats:"
echo "| "$GRPH_FMT
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
action= action=
for report in $GRPH_REP; do for report in $GRPH_REP; do
for fmt in $GRPH_FMT; do for fmt in $GRPH_FMT; do
action="$action -a report -p name=$report,id=I44,off=$fmt,of=$TDIR/$report.$fmt" action="$action -a report -p name=$report,id=I44,off=$fmt,of=$REP_DIR/$report.$fmt"
done done
done done
(cd $GDIR/src; $PRG $OPTS $action) (cd $SRC_DIR; $PRG $OPTS $action)
# Single run with all textual reports in all formats # Single run with all textual reports in all formats
echo "" echo ""
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
echo "| Reports:" echo "| Text Reports: "$TEXT_REP
echo "| "$TEXT_REP echo "| Text Formats: "$TEXT_FMT
echo "| Formats:"
echo "| "$TEXT_FMT
echo "+--------------------------------------------------------------" echo "+--------------------------------------------------------------"
action= action=
for report in $TEXT_REP; do for report in $TEXT_REP; do
for fmt in $TEXT_FMT; do for fmt in $TEXT_FMT; do
action="$action -a report -p name=$report,id=I44,off=$fmt,of=$TDIR/$report.$fmt" action="$action -a report -p name=$report,id=I44,off=$fmt,of=$REP_DIR/$report.$fmt"
done done
done done
(cd $GDIR/src; $PRG $OPTS $action) (cd $SRC_DIR; $PRG $OPTS $action)