diff --git a/gramps2/test/.cvsignore b/gramps2/test/.cvsignore new file mode 100644 index 000000000..fe2e5865d --- /dev/null +++ b/gramps2/test/.cvsignore @@ -0,0 +1,2 @@ +data +reports diff --git a/gramps2/test/impex.sh b/gramps2/test/impex.sh index 51b7a4386..d44e712e3 100755 --- a/gramps2/test/impex.sh +++ b/gramps2/test/impex.sh @@ -1,4 +1,8 @@ #! /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$ @@ -7,30 +11,35 @@ TEST_DIR=$TOP_DIR/test 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" +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 "| Import XML, write GRDB" echo "+--------------------------------------------------------------" -rm $TEST_DIR/example.grdb -OPTS="-i $EXAMPLE_XML -o $TEST_DIR/example.grdb" +OPTS="-i $EXAMPLE_XML -o $DATA_DIR/example.grdb" (cd $SRC_DIR; $PRG $OPTS) echo "" echo "+--------------------------------------------------------------" echo "| Check GRDB for errors" 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) echo "" echo "+--------------------------------------------------------------" echo "| Open GRDB, write all other formats" echo "+--------------------------------------------------------------" -OPTS="-O $TEST_DIR/example.grdb" +OPTS="-O $DATA_DIR/example.grdb" 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 (cd $SRC_DIR; $PRG $OPTS) @@ -39,8 +48,8 @@ echo "+--------------------------------------------------------------" echo "| Validate produced XML" echo "+--------------------------------------------------------------" 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" -xmllint --noout --postvalid example.gramps-xml +xmllint --noout --postvalid $DATA_DIR/example.gramps-xml 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 diff --git a/gramps2/test/runtest.sh b/gramps2/test/runtest.sh index 448e48ddb..59f4ec5cb 100755 --- a/gramps2/test/runtest.sh +++ b/gramps2/test/runtest.sh @@ -1,11 +1,24 @@ #! /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$ -GDIR=`dirname $PWD` -TDIR=$GDIR/test -OPTS="-i $GDIR/example/gramps/example.gramps -f gramps-xml" +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 + +REP_DIR=$TEST_DIR/reports +mkdir -p $REP_DIR + +OPTS="-i $EXAMPLE_XML" GRPH_FMT="sxw ps pdf svg" 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 echo "" echo "+--------------------------------------------------------------" -echo "| Reports:" -echo "| "$GRPH_REP -echo "| Formats:" -echo "| "$GRPH_FMT +echo "| Graphical Reports: "$GRPH_REP +echo "| Graphical Formats: "$GRPH_FMT echo "+--------------------------------------------------------------" action= for report in $GRPH_REP; 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 -(cd $GDIR/src; $PRG $OPTS $action) +(cd $SRC_DIR; $PRG $OPTS $action) # Single run with all textual reports in all formats echo "" echo "+--------------------------------------------------------------" -echo "| Reports:" -echo "| "$TEXT_REP -echo "| Formats:" -echo "| "$TEXT_FMT +echo "| Text Reports: "$TEXT_REP +echo "| Text Formats: "$TEXT_FMT echo "+--------------------------------------------------------------" action= for report in $TEXT_REP; 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 -(cd $GDIR/src; $PRG $OPTS $action) +(cd $SRC_DIR; $PRG $OPTS $action)