#! /bin/ksh
+#
+# Graphviz regression test driver
+#
+# Assumes the programs dot and diffimg are in PATH.
+# Also relies on strps.awk.
+#
# TODO:
# Fix to allow multiple test data sets depending
# on architecture, etc. Maintain common ones in REFDIR.
-# Report differences with shared version and with new output.
+# Report differences with shared version and with new output.
TESTFILE=tests.txt # Test specifications
GRAPHDIR=graphs # Directory of input graphs and data
ps )
mv $FILE1 $TMPFILE
awk -f strps.awk $TMPFILE > $FILE1
- awk -f strps.awk $FILE22 > $TMPFILE
+ awk -f strps.awk $FILE2 > $TMPFILE
diff -q $FILE1 $TMPFILE > /dev/null
;;
svg )
{
if [[ $3 == *:* ]]
then
- FMT=${3%%:*}
- XFMT=${3#$FMT}
+ F=${3%%:*}
+ XFMT=${3#$F}
XFMT=${XFMT/:/_}
else
- FMT=$3
+ F=$3
XFMT=""
fi
- IDX="$2$XFMT$FMT"
+ IDX="$2$XFMT$F"
j=${TESTTYPES[$IDX]}
if (( j == 0 ))
then
TESTTYPES[$IDX]=$(( j+1 ))
J=$j
fi
- OUTFILE="$1_$2$XFMT$J.$FMT"
+ OUTFILE="$1_$2$XFMT$J.$F"
}
function doTest
;;
esac
- # clear TESTTYPES
- for x in ${!TESTYPES[@]}
- do
- TESTTYPES[$x]=0
- done
-
for ((i=0;i<SUBTESTCNT;i++))
do
genOutname $TESTNAME ${ALG[$i]} ${FMT[$i]}
fi
dot -K${ALG[$i]} -T${FMT[$i]} ${FLAGS[$i]} -o$OUTPATH $INFILE 2> errout
+ RVAL=$?
- if [[ $GENERATE == 1 ]]
+ if [[ $RVAL != 0 || ! -s $OUTPATH ]]
then
- continue
- fi
-
- if [[ $? != 0 || -s errout ]]
+ print -u 2 "Test $TESTNAME:$i : == Layout failed =="
+ elif [[ $GENERATE == 1 ]]
then
- print -u 2 "Test $TESTNAME:$i : == Crashed =="
+ continue
else
doDiff $TESTNAME $i ${FMT[$i]}
fi
done
+
+ # clear TESTTYPES
+ for W in ${!TESTTYPES[@]}
+ do
+ TESTTYPES[$W]=0
+ done
}
trap 'rm -f $TMPFILE $TMPINFILE errout; exit' 0 1 2 3 15
;;
g )
GENERATE=1
- if [[! -d "$REFDIR" ]]
+ if [[ ! -d "$REFDIR" ]]
then
mkdir $REFDIR
fi
done
shift $((OPTIND-1))
+# Check environment and initialize
+
+if [[ ! -d "$REFDIR" ]]
+then
+ print -u 2 "Test data directory $REFDIR does not exit"
+ exit 1
+fi
+
+if [[ ! -d "$OUTDIR" ]]
+then
+ mkdir $OUTDIR
+fi
+
+if ! whence diffimg > /dev/null
+then
+ print -u 2 "diffimg program is not in your PATH"
+ exit 1
+fi
+exit
+
exec 3< $TESTFILE
while readTest
do
color
=
dot png
-dot png - Gbgcolor = lightblue
+dot png -Gbgcolor=lightblue
decorate
=
dot png:gd
#dot png - doesn't work: Warning: No loadimage plugin for "gif:cairo"
+# bug - the epsf version has problems
ps_user_shapes
=
dot ps -Nshapefile=graphs/dice.ps
-dot ps -Nshape=epsf -Nshapefile=graphs/dice.ps
+#dot ps -Nshape=epsf -Nshapefile=graphs/dice.ps
colorscheme
=
clustlabel
=
-dot ps "-Glabelloc=t -Glabeljust=r"
-dot ps "-Glabelloc=b -Glabeljust=r"
-dot ps "-Glabelloc=t -Glabeljust=l"
-dot ps "-Glabelloc=b -Glabeljust=l"
-dot ps "-Glabelloc=t -Glabeljust=c"
-dot ps "-Glabelloc=b -Glabeljust=c"
-dot ps "-Glabelloc=t"
-dot ps "-Glabelloc=b"
+dot ps -Glabelloc=t -Glabeljust=r
+dot ps -Glabelloc=b -Glabeljust=r
+dot ps -Glabelloc=t -Glabeljust=l
+dot ps -Glabelloc=b -Glabeljust=l
+dot ps -Glabelloc=t -Glabeljust=c
+dot ps -Glabelloc=b -Glabeljust=c
+dot ps -Glabelloc=t
+dot ps -Glabelloc=b
rootlabel
=
-dot ps "-Glabelloc=t -Glabeljust=r"
-dot ps "-Glabelloc=b -Glabeljust=r"
-dot ps "-Glabelloc=t -Glabeljust=l"
-dot ps "-Glabelloc=b -Glabeljust=l"
-dot ps "-Glabelloc=t -Glabeljust=c"
-dot ps "-Glabelloc=b -Glabeljust=c"
-dot ps "-Glabelloc=t"
-dot ps "-Glabelloc=b"
+dot ps -Glabelloc=t -Glabeljust=r
+dot ps -Glabelloc=b -Glabeljust=r
+dot ps -Glabelloc=t -Glabeljust=l
+dot ps -Glabelloc=b -Glabeljust=l
+dot ps -Glabelloc=t -Glabeljust=c
+dot ps -Glabelloc=b -Glabeljust=c
+dot ps -Glabelloc=t
+dot ps -Glabelloc=b
layers
=
=
neato ps -Gmode=KK
neato ps -Gmode=hier
-neato ps "-Gmode=hier -Glevelsgap=1"
+neato ps -Gmode=hier -Glevelsgap=1
model
mode.dot
page
mode.dot
-neato ps "-Gpage=8.5,11"
-neato ps "-Gpage=8.5,11 -Gpagedir=TL"
-neato ps "-Gpage=8.5,11 -Gpagedir=TR"
+neato ps -Gpage=8.5,11
+neato ps -Gpage=8.5,11 -Gpagedir=TL
+neato ps -Gpage=8.5,11 -Gpagedir=TR
# pencolor, fontcolor, fillcolor
colors
viewport
=
-neato png "-Gviewport=300,300 -n2"
-neato ps "-Gviewport=300,300 -n2"
-neato png "-Gviewport=300,300,1,200,620 -n2"
-neato ps "-Gviewport=300,300,1,200,620 -n2"
-neato png "-Gviewport=300,300,2,200,620 -n2"
-neato ps "-Gviewport=300,300,2,200,620 -n2"
+neato png -Gviewport=300,300 -n2
+neato ps -Gviewport=300,300 -n2
+neato png -Gviewport=300,300,1,200,620 -n2
+neato ps -Gviewport=300,300,1,200,620 -n2
+neato png -Gviewport=300,300,2,200,620 -n2
+neato ps -Gviewport=300,300,2,200,620 -n2
rowcolsep
=
-dot dot -Tnodesep=0.5
-dot dot -Tranksep=1.5
+dot dot -Gnodesep=0.5
+dot dot -Granksep=1.5
size
mode.dot
-neato ps "-Gsize=5,5"
-neato png "-Gsize=5,5"
+neato ps -Gsize=5,5
+neato png -Gsize=5,5
# size with !
size_ex
root.dot
-dot ps "-Gsize=6,6!"
-dot png "-Gsize=6,6!"
+dot ps -Gsize=6,6!
+dot png -Gsize=6,6!
dotsplines
size.dot
neatosplines
overlap.dot
neato dot -Goverlap=false -Gsplines=splines
-neato dot -Goverlap=false -Gsplines=polyline
+#neato dot -Goverlap=false -Gsplines=polyline
#neato dot -Goverlap=false -Gsplines=ortho
style
cairo
=
-dot -Tps:cairo
-dot -Tpng:cairo
-dot -Tsvg:cairo
+dot ps:cairo
+dot png:cairo
+dot svg:cairo