]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: dump logs on failure to aid investigation
authorMaksym Sobolyev <sobomax@sippysoft.com>
Fri, 13 Mar 2026 22:32:46 +0000 (15:32 -0700)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 24 Mar 2026 18:27:33 +0000 (19:27 +0100)
test/run

index 43ae62e6fcdf1ad35c5286b70bcea989f8457dab..c70aef454c1d01119d0adbfd368401211f3e2cd7 100755 (executable)
--- 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 "$@"