test: avoid errors in exit_handler

Avoid generating errors in the exit_handler, as those could be
misinterpreted as red herrings for the actual error being trapped.

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
This commit is contained in:
Marco Vedovati 2018-11-21 09:42:47 +01:00
parent eb92306c48
commit 9c0773a399

View File

@ -153,11 +153,26 @@ exit_handler()
info "ERROR: test failed"
# The test failed so dump what we can
info "images:"
sudo -E ls -l "${images_dir}" >&2
if [ -d "${tmp_rootfs}" ]; then
info "rootfs:"
sudo -E ls -l "${tmp_rootfs}" >&2
else
info "no rootfs created"
# If no rootfs are created, no need to dump other info
return
fi
info "rootfs:"
sudo -E ls -l "${tmp_rootfs}" >&2
if [ -d "${images_dir}" ]; then
info "images:"
sudo -E ls -l "${images_dir}" >&2
else
info "no images created"
# If no images are created, no need to dump other info
return
fi
# Travis tests do not install kata
[ -n "${TRAVIS:-}" ] && return
info "local runtime config:"
cat /etc/kata-containers/configuration.toml >&2
@ -172,7 +187,7 @@ exit_handler()
sudo -E ps -efwww | egrep "docker|kata" >&2
# Restore the default image in config file
[ -n "${TRAVIS:-}" ] || chronic $mgr configure-image
chronic $mgr configure-image
}
die()