From: Jakub Ružička Date: Wed, 26 Apr 2023 15:26:30 +0000 (+0200) Subject: Distro: Add apkg packaging test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c8847def7303a70ee4b4ea928411a99696e20ae;p=thirdparty%2Fbird.git Distro: Add apkg packaging test The test was written by Maria Matejka, thanks! Run this using apkg test --- diff --git a/distro/tests/control b/distro/tests/control new file mode 100644 index 000000000..b1476dbba --- /dev/null +++ b/distro/tests/control @@ -0,0 +1,3 @@ +Tests: test-bird.sh +Restrictions: needs-root +Depends: bird2 diff --git a/distro/tests/test-bird.sh b/distro/tests/test-bird.sh new file mode 100755 index 000000000..464be32f0 --- /dev/null +++ b/distro/tests/test-bird.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +set -e + +LOCAL=2001:db8:dead:: + +EXTERNAL=2001:db8:beef:: +EXTERNAL_NET=${EXTERNAL}/48 +EXTERNAL_NH=${LOCAL}beef + +LEARN=2001:db8:feed:: +LEARN_NET=${LEARN}/48 +LEARN_NH=${LOCAL}feed + +IFACE=bird-test-dummy +IFACE_EXISTS=false + +BIRD_RUNNING=false + +D=$(mktemp -d) +pushd ${D} >/dev/null + +stop_bird() { + birdc -l down >/dev/null + sleep 1 + grep -q " Shutdown completed" bird.log + [ ! -e bird.pid ] + [ ! -e bird.ctl ] +} + +cleanup() { + if ${BIRD_RUNNING}; then + stop_bird + if [ -e bird.pid ]; then + kill -9 $( /dev/null + rm -rf ${D} +} + +failed() { + cleanup + exit 1 +} + +trap failed ERR +trap failed INT +trap failed HUP + +ip link add ${IFACE} type dummy +IFACE_EXISTS=true + +ip link set ${IFACE} up +ip -6 addr add ${LOCAL}/64 dev bird-test-dummy + +ip -6 route add ${LEARN_NET} via ${LEARN_NH} + +cat >bird.conf <