mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
kernel: test: improve error handler
print output from last command that failed. Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
@@ -296,10 +296,10 @@ main() {
|
||||
if [ -z "${kernel_path}" ]; then
|
||||
config_version=$(get_config_version)
|
||||
kernel_path="${PWD}/kata-linux-${kernel_version}-${config_version}"
|
||||
info "Config version: ${config_version}"
|
||||
fi
|
||||
|
||||
info "Kernel version: ${kernel_version}"
|
||||
info "Config version: ${config_version}"
|
||||
|
||||
case "${subcmd}" in
|
||||
build)
|
||||
|
@@ -7,6 +7,7 @@
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o errtrace
|
||||
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly build_kernel_sh="${script_dir}/build-kernel.sh"
|
||||
@@ -17,6 +18,16 @@ exit_handler() {
|
||||
}
|
||||
trap exit_handler EXIT
|
||||
|
||||
err_report() {
|
||||
echo "Error:"
|
||||
echo "line: $1"
|
||||
echo "Last saved output:"
|
||||
echo "${out:-}"
|
||||
}
|
||||
|
||||
trap 'err_report $LINENO' ERR
|
||||
|
||||
|
||||
OK() {
|
||||
echo "OK"
|
||||
}
|
||||
|
Reference in New Issue
Block a user