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:
Jose Carlos Venegas Munoz
2019-01-09 11:21:13 -06:00
parent 789970bc43
commit 95fef541c2
2 changed files with 12 additions and 1 deletions

View File

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

View File

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