Skip to content

Commit

Permalink
Improve error display on failure (#2696)
Browse files Browse the repository at this point in the history
* Improve error display on failure

* Add documentation

* Fix typo

* Remove stream redirection
  • Loading branch information
JohanBertrand authored Apr 23, 2024
1 parent 8aa3c3f commit 7724562
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ build-fprime-automatic*
/RPI/bin
/ci-venv/
/ci-logs*
/ci-Framework-logs*
TesterBase.*
GTestBase.*
**/DefaultDict/serializable/*
Expand Down
30 changes: 24 additions & 6 deletions ci/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,31 @@ function fail_and_stop()
echo -e "${RED}---------------- ERROR ----------------" 1>&2
echo "${1}" 1>&2
echo -e "---------------------------------------${NOCOLOR}" 1>&2
LASTLOG=$(ls -td $(find "${LOG_DIR}" -name "*err.log" -type f) | head -1)
if [ -f "${LASTLOG}" ]

# Look for an stderr log which is not empty
LASTLOG_ERR=$(ls -td $(find "${LOG_DIR}" -name "*err.log" -type f) | head -1)

if [ -f "${LASTLOG_ERR}" ]
then

echo -e "---------------- STDERR ---------------" 1>&2
tail -30 "${LASTLOG}" 1>&2
echo -e "---------------------------------------" 1>&2
# Check if a related stdout log exist
LASTLOG_OUT="${LASTLOG_ERR::-7}out.log"

if [ -f "${LASTLOG_OUT}" ]
then
# Display stdout log
echo -e "${RED}---------------- STDOUT ---------------${NOCOLOR}" 1>&2
cat "${LASTLOG_OUT}" 1>&2
echo -e "${RED}---------------------------------------${NOCOLOR}" 1>&2
fi

# Display stderr log
echo -e "${RED}---------------- STDERR ---------------${NOCOLOR}" 1>&2
cat "${LASTLOG_ERR}" 1>&2
echo -e "${RED}---------------------------------------${NOCOLOR}" 1>&2

echo -e "${RED}---------------- END ERROR ------------" 1>&2
echo "${1}" 1>&2
echo -e "---------------------------------------${NOCOLOR}" 1>&2
fi
archive_logs
exit 1
Expand Down

0 comments on commit 7724562

Please sign in to comment.