Automate graphviz regression tests.

OK (and some input from) ajacoutot@
This commit is contained in:
edd 2012-08-31 19:50:01 +00:00
parent 5eeb506019
commit 01f1be4c53
12 changed files with 129 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.48 2012/08/22 22:15:49 edd Exp $
# $OpenBSD: Makefile,v 1.49 2012/08/31 19:50:01 edd Exp $
COMMENT-main= graph drawing software
@ -62,6 +62,8 @@ LIB_DEPENDS= graphics/jpeg \
RUN_DEPENDS= lang/guile
BUILD_DEPENDS= devel/swig \
lang/guile
REGRESS_DEPENDS=math/graphviz
WANTLIB += GL ICE SM X11 Xau Xaw Xcomposite Xcursor Xdamage Xdmcp
WANTLIB += Xext Xfixes Xi Xinerama Xmu Xpm Xrandr Xrender Xt Xxf86vm
WANTLIB += atk-1.0 c cairo croco-0.6 drm expat ffi fontconfig
@ -137,6 +139,17 @@ post-install:
${SUBST_CMD} -c ${FILESDIR}/config6 ${PREFIX}/lib/graphviz/config6
chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/graphviz/config6
# Local tests for OpenBSD
# Can't run built in tests, as requires ksh93 (some specific arguments
# to the typeset builtin). Currently, there is no port.
TEST_TMP=${WRKDIR}/test_tmp
do-regress:
mkdir -p ${TEST_TMP}
cd ${FILESDIR}/tests && for i in *-test.* run_tests.sh; do \
${SUBST_CMD} -c $${i} ${TEST_TMP}/$${i}; \
done
cd ${TEST_TMP} && /bin/sh ./run_tests.sh
# NOTE: When updating this port:
# * Check we have commented .la and .a corresponding to unversioned .so files
# in the packing list.

View File

@ -0,0 +1,5 @@
digraph g {
"a" -> "b";
"b" -> "c";
"c" -> "a";
}

View File

@ -0,0 +1,11 @@
digraph g {
node [label="\N"];
graph [bb="0,0,81,180"];
a [pos="54,162", width="0.75", height="0.5"];
b [pos="27,90", width="0.75", height="0.5"];
c [pos="54,18", width="0.75", height="0.5"];
a -> b [pos="e,33.54,107.96 47.601,144.41 44.486,136.34 40.666,126.43 37.165,117.35"];
b -> c [pos="e,47.46,35.956 33.399,72.411 36.514,64.335 40.334,54.431 43.835,45.355"];
c -> a [pos="e,57.654,143.91 57.654,36.092 59.676,46.431 61.981,59.91 63,72 64.344,87.943 64.344,92.057 63,108 62.283,116.5 60.931,125.69 59.488\
,133.99"];
}

View File

@ -1,4 +1,4 @@
(load-extension "/usr/local/lib/graphviz/guile/libgv_guile.so" "SWIG_init");
(load-extension "${LOCALBASE}/lib/graphviz/guile/libgv_guile.so" "SWIG_init");
(define g (digraph "g"));
(define n1 (node g "a"));
@ -10,5 +10,5 @@
(define e3 (edge n3 n1));
(layout g "dot");
(render g "xlib");
(render g "dot");

View File

@ -0,0 +1,11 @@
digraph g {
node [label="\N"];
graph [bb="0,0,81,180"];
a [pos="54,162", width="0.75", height="0.5"];
b [pos="27,90", width="0.75", height="0.5"];
c [pos="54,18", width="0.75", height="0.5"];
a -> b [pos="e,33.54,107.96 47.601,144.41 44.486,136.34 40.666,126.43 37.165,117.35"];
b -> c [pos="e,47.46,35.956 33.399,72.411 36.514,64.335 40.334,54.431 43.835,45.355"];
c -> a [pos="e,57.654,143.91 57.654,36.092 59.676,46.431 61.981,59.91 63,72 64.344,87.943 64.344,92.057 63,108 62.283,116.5 60.931,125.69 59.488\
,133.99"];
}

View File

@ -0,0 +1,7 @@
graph g {
1 -- 2;
2 -- 3;
4 -- 3;
5 -- 3;
3 -- 1;
}

View File

@ -0,0 +1,14 @@
graph g {
node [label="\N"];
graph [bb="0,0,176.35,163.87"];
1 [pos="41.352,25.566", width="0.75", height="0.5"];
2 [pos="108.39,18", width="0.75", height="0.5"];
3 [pos="82.599,90.149", width="0.75", height="0.5"];
4 [pos="27,145.87", width="0.75", height="0.5"];
5 [pos="149.35,131.88", width="0.75", height="0.5"];
1 -- 2 [pos="68.233,22.532 72.604,22.039 77.133,21.528 81.504,21.034"];
2 -- 3 [pos="102.02,35.835 98.018,47.018 92.885,61.375 88.901,72.52"];
4 -- 3 [pos="42.193,130.65 50.038,122.78 59.582,113.22 67.425,105.36"];
5 -- 3 [pos="129.32,119.36 120.88,114.08 111.06,107.94 102.61,102.66"];
3 -- 1 [pos="71.977,73.517 65.866,63.95 58.21,51.962 52.081,42.366"];
}

View File

@ -12,4 +12,4 @@ gv::edge($n2, $n3) ;
gv::edge($n3, $n1) ;
gv::layout($g, 'dot');
gv::render($g, 'xlib' );
gv::render($g, 'dot' );

View File

@ -0,0 +1,10 @@
graph test {
node [label="\N"];
graph [bb="0,0,81,180"];
a [pos="54,162", width="0.75", height="0.5"];
b [pos="27,90", width="0.75", height="0.5"];
c [pos="54,18", width="0.75", height="0.5"];
a -- b [pos="47.601,144.41 43.36,133.41 37.811,119.03 33.54,107.96"];
b -- c [pos="33.399,72.411 37.64,61.414 43.189,47.027 47.46,35.956"];
c -- a [pos="57.654,36.092 59.676,46.431 61.981,59.91 63,72 64.344,87.943 64.344,92.057 63,108 61.981,120.09 59.676,133.57 57.654,143.91"];
}

View File

@ -0,0 +1,42 @@
#!/bin/sh
#
# $OpenBSD: run_tests.sh,v 1.1 2012/08/31 19:50:01 edd Exp $
# Simple regression tests for the OpenBSD graphviz port
# Required due to single threaded interpreters (see README)
export LD_PRELOAD=/usr/lib/libpthread.so
# Silence deprecated guile constructs
export GUILE_WARN_DEPRECATED=no
# List of tests to run, of the form:
# compiler:testfile
tests="${LOCALBASE}/bin/guile:guile-test.scm"
tests="${tests} /usr/bin/perl:perl-test.pl"
tests="${tests} ${MODTCL_BIN}:tcl-test.tcl"
tests="${tests} ${LOCALBASE}/bin/dot:dot-test.dot"
tests="${tests} ${LOCALBASE}/bin/neato:neato-test.nto"
for t in ${tests}; do
compiler=`echo $t | awk -F: '{print $1}'`
infile=`echo $t | awk -F: '{print $2}'`
outfile=${infile}.out
expectfile=${infile}.expect
difffile=${infile}.diff
echo "Running test: ${infile}"
if ! ${compiler} ${infile} > ${outfile}; then
echo "FAILED (execution failed)" && exit 1
fi
if [ ! -f ${expectfile} ]; then
echo "FAILED (missing expected outcome)" && exit 1
fi
if ! diff -u ${expectfile} ${outfile} > ${difffile}; then
echo "FAILED (unexpected outcome)" && cat ${difffile} && exit 1
fi
rm ${difffile} ${outfile}
echo "PASSED"
done

View File

@ -17,4 +17,4 @@ set E2 [gv::edge $N2 $N3]
set E3 [gv::edge $N3 $N1]
gv::layout $G dot
gv::render $G xlib
gv::render $G dot

View File

@ -0,0 +1,11 @@
digraph G {
node [label="\N"];
graph [bb="0,0,81,180"];
a [pos="54,162", width="0.75", height="0.5"];
b [pos="27,90", width="0.75", height="0.5"];
c [pos="54,18", width="0.75", height="0.5"];
a -> b [pos="e,33.54,107.96 47.601,144.41 44.486,136.34 40.666,126.43 37.165,117.35"];
b -> c [pos="e,47.46,35.956 33.399,72.411 36.514,64.335 40.334,54.431 43.835,45.355"];
c -> a [pos="e,57.654,143.91 57.654,36.092 59.676,46.431 61.981,59.91 63,72 64.344,87.943 64.344,92.057 63,108 62.283,116.5 60.931,125.69 59.488\
,133.99"];
}