diff options
author | Kristof Provost <kp@FreeBSD.org> | 2021-12-13 12:01:27 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2021-12-13 14:54:03 +0000 |
commit | 4826406b30f9756102a1443273aeb9d7dd5d80c7 (patch) | |
tree | a8c53b37cf93814a7d2371876c4278e04d3a828e | |
parent | 8f19f3d31a7224c502c36dd16f1321b802e4da60 (diff) | |
download | src-4826406b30f9756102a1443273aeb9d7dd5d80c7.tar.gz src-4826406b30f9756102a1443273aeb9d7dd5d80c7.zip |
pf tests: log additional information when a test ends
Log information from the running jails (routing, interfaces and pf) as
well as interfaces on the host.
This information is expected to be useful in debugging test failures.
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
-rw-r--r-- | tests/sys/netpfil/pf/utils.subr | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr index c9a404c8012e..9afd6280707e 100644 --- a/tests/sys/netpfil/pf/utils.subr +++ b/tests/sys/netpfil/pf/utils.subr @@ -28,8 +28,39 @@ . $(atf_get_srcdir)/../../common/vnet.subr +pft_onerror() +{ + status=$? + + echo "Debug log." + echo "==========" + echo "Test exit status: $?" + echo + + if [ -f created_jails.lst ]; then + for jailname in `cat created_jails.lst` + do + echo "Jail ${jailname}" + echo "----------------" + jexec ${jailname} ifconfig + jexec ${jailname} netstat -rn + jexec ${jailname} pfctl -sa -v + done + fi + + echo "Created interfaces:" + echo "-------------------" + cat created_interfaces.lst + + echo "Host interfaces:" + echo "----------------" + ifconfig +} + pft_init() { + trap pft_onerror EXIT + vnet_init if [ ! -c /dev/pf ]; then |