From 2ee883aa1a3bae8fc38fefa4a67b021924be8cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Wennerstr=C3=B6m?= Date: Mon, 21 Dec 2020 16:07:58 +0100 Subject: [PATCH] Print logs on error in CI Because we trap the error signal and run a error handler, logs were not printed. I moved the printing of test-suite.log to the error handler and also added so that config.log is printed on failure. --- ci-build.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ci-build.sh b/ci-build.sh index 0a42e099..2d615a9a 100755 --- a/ci-build.sh +++ b/ci-build.sh @@ -1,8 +1,19 @@ #!/usr/bin/env bash +log_content() +{ + echo + echo "Content of $1:" + cat "$1" +} + error_handler() { ERR_CODE=$? + + log_content ./config.log + log_content ./test-suite.log + echo echo "Error ${ERR_CODE} with command '${BASH_COMMAND}' on line ${BASH_LINENO[0]}. Exiting." echo @@ -114,10 +125,6 @@ do $MAKE CC="${CC}" $MAKE check - if [ $? -eq 1 ]; then - cat ./test-suite.log - fi - ./profanity -v $MAKE clean done