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")
This commit is contained in:
Kristof Provost 2021-12-13 13:01:27 +01:00
parent 8f19f3d31a
commit 4826406b30

View File

@ -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