From: Maksym Sobolyev Date: Fri, 13 Mar 2026 22:32:46 +0000 (-0700) Subject: test: dump logs on failure to aid investigation X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=869f4fa57c5facc7778690fc0e1d43e7b298a48d;p=thirdparty%2Fccache.git test: dump logs on failure to aid investigation --- diff --git a/test/run b/test/run index 43ae62e6..c70aef45 100755 --- a/test/run +++ b/test/run @@ -53,6 +53,12 @@ test_failed_internal() { local line="$(caller 1)" line=" (line ${line%% *})" + if [ ! -z "${CI}" ] + then + dump_failure_log "CCACHE_LOGFILE" "${CCACHE_LOGFILE:-}" + dump_failure_log "CRSH_LOGFILE" "${CRSH_LOGFILE:-}" + fi + echo red FAILED echo @@ -75,6 +81,28 @@ test_failed_internal() { exit 1 } +dump_failure_log() { + local label="$1" + local path="$2" + + if [ -z "$path" ]; then + return + fi + + if [[ $path != /* ]]; then + path="$PWD/$path" + fi + + if [ ! -f "$path" ]; then + return + fi + + echo "$label ($path)" + echo "==========================" + tail -n 200 "$path" + echo +} + # Indirection so the line returned by `caller` is correct. test_failed() { test_failed_internal "$@"