Package: frr
Version: 10.5.1-1
Priority: normal

Dear Maintainer,

here is a patch to the autopkgtests that you may find useful. It shows
extra logs when there is a test failure.
diff --git a/debian/tests/bgpd-snmp-rpki b/debian/tests/bgpd-snmp-rpki
index 1a25311c67..7957a985c7 100755
--- a/debian/tests/bgpd-snmp-rpki
+++ b/debian/tests/bgpd-snmp-rpki
@@ -3,6 +3,8 @@ set -e
 
 . debian/tests/utils
 
+trap cleanup EXIT
+
 # enable bgpd with SNMP & RPKI modules
 cat >> /etc/frr/daemons << EOF
 bgpd=yes
diff --git a/debian/tests/py-frr-reload b/debian/tests/py-frr-reload
index 658f1605bb..13ab297244 100755
--- a/debian/tests/py-frr-reload
+++ b/debian/tests/py-frr-reload
@@ -4,6 +4,8 @@ set -e
 
 . debian/tests/utils
 
+trap cleanup EXIT
+
 # should have been started on install, but policy may have inhibited that
 service frr restart
 
diff --git a/debian/tests/utils b/debian/tests/utils
index 66e113cd19..b2c7b1fcde 100644
--- a/debian/tests/utils
+++ b/debian/tests/utils
@@ -24,3 +24,29 @@ Wait_for_service ()
 
 	echo " done."
 }
+
+cleanup() {
+    result=$?
+    set +e
+    if [ "$result" -ne 0 ]; then
+        echo "### Something failed, showing logs"
+        echo
+        echo "### Last 100 lines of syslog:"
+        tail -n 100 /var/log/syslog
+        echo
+        for f in /var/log/frr/*.log; do
+            if [ -f "$f" ]; then
+                echo "### Last 100 lines of $f:"
+                tail -n 100 "$f"
+                echo
+            fi
+        done
+        echo "### ps output:"
+        ps fauxwZ
+        echo
+        echo "### Last 100 dmesg lines:"
+        dmesg -T | tail -n 100 || :
+    else
+        echo "### ALL TESTS PASSED"
+    fi
+}
diff --git a/debian/tests/zebra-lo b/debian/tests/zebra-lo
index 4b8a09070e..e16ed6a7b6 100755
--- a/debian/tests/zebra-lo
+++ b/debian/tests/zebra-lo
@@ -4,6 +4,8 @@ set -e
 
 . debian/tests/utils
 
+trap cleanup EXIT
+
 # should have been started on install, but policy may have inhibited that
 service frr status >/dev/null || service frr restart
 

Reply via email to