From aaabb66e4a04a7f2119a08dcea2c0ec5f853c37e Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 17 Dec 2018 18:55:31 +0100 Subject: [PATCH] debian: rework autopkgtests Ditch the old non-working one and add 3 new ones to check: - that zebra can talk to the kernel at least somewhat - that SNMP and RPKI modules can be loaded - that frr-reload.py works This should catch most build environment SNAFUs. Signed-off-by: David Lamparter --- debian/tests/bgpd-snmp-rpki | 22 ++++++++++++++++++++++ debian/tests/control | 12 ++++++++++-- debian/tests/daemons | 30 ------------------------------ debian/tests/py-frr-reload | 28 ++++++++++++++++++++++++++++ debian/tests/zebra-lo | 16 ++++++++++++++++ 5 files changed, 76 insertions(+), 32 deletions(-) create mode 100755 debian/tests/bgpd-snmp-rpki delete mode 100644 debian/tests/daemons create mode 100755 debian/tests/py-frr-reload create mode 100755 debian/tests/zebra-lo diff --git a/debian/tests/bgpd-snmp-rpki b/debian/tests/bgpd-snmp-rpki new file mode 100755 index 0000000000..91e4bdda55 --- /dev/null +++ b/debian/tests/bgpd-snmp-rpki @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +# enable bgpd with SNMP & RPKI modules +cat >> /etc/frr/daemons < /dev/null 2>&1 - -# check daemons -for daemon in "${DAEMONS[@]}" -do - echo -n "check $daemon - " - if pidof -x $daemon > /dev/null; then - echo "${daemon} OK" - else - echo "ERROR: ${daemon} IS NOT RUNNING" - exit 1 - fi -done diff --git a/debian/tests/py-frr-reload b/debian/tests/py-frr-reload new file mode 100755 index 0000000000..a50647a89d --- /dev/null +++ b/debian/tests/py-frr-reload @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +# should have been started on install, but policy may have inhibited that +service frr restart + +# these should be running by default +killall -0 watchfrr +killall -0 zebra +killall -0 staticd + +# configure interactively, save to file +vtysh -c 'configure terminal' -c 'ip route 198.51.100.0/28 127.0.0.1' +vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.0/28 127.0.0.1' +vtysh -c 'write memory' + +grep -q 'ip route 198.51.100.0/28 127.0.0.1' /etc/frr/frr.conf + +# configure in file, check interactively +sed -e '/^ip route 198.51.100.0\/28 127.0.0.1/ c ip route 198.51.100.64/28 127.0.0.1' \ + -i /etc/frr/frr.conf + +service frr reload + +vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.64/28 127.0.0.1' +if vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.0/28 127.0.0.1'; then + exit 1 +fi diff --git a/debian/tests/zebra-lo b/debian/tests/zebra-lo new file mode 100755 index 0000000000..ffd9c72adc --- /dev/null +++ b/debian/tests/zebra-lo @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +# should have been started on install, but policy may have inhibited that +service frr status >/dev/null || service frr restart + +# these should be running by default +killall -0 watchfrr +killall -0 zebra +killall -0 staticd + +# check vtysh works at all +vtysh -c 'show version' + +# check zebra is properly talking to the kernel +vtysh -c 'show interface lo' | grep -q LOOPBACK -- 2.39.5