Files
httrack/tests/143_engine-backtrace-empty.test
Xavier Roche fac60dff4a armhf crash reports have no frames, and the empty backtrace fails the build (#893)
* armhf crash reports have no frames, and the empty backtrace fails the build

gcc emits no unwind tables on armhf, so backtrace() comes back empty and the
handler printed a frameless report, which the crash tests read as a failure and
which left 3.49.15-1 stuck at Build-Attempted there. Ask for
-fasynchronous-unwind-tables where the compiler takes it, and say why the report
has no frames when the unwinder still returns nothing.

Closes #892

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>

* Let ASan tolerate the backtrace shim's link order

An LD_PRELOAD library loads ahead of the executable's own libasan, which ASan
refuses by default, so the sanitize leg never reached the crash it was meant to
inspect. Same waiver the other interposer tests carry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>

* Keep an empty backtrace a failure everywhere but 32-bit ARM

Relaxing test 80's skip to the shared message prefix let it swallow the new
"unwinding failed" wording too, so a build that traced nothing anywhere would
have gone green on every architecture. Skip only where nothing can be done
about it: the OS-less case, and 32-bit ARM if its toolchain still refuses to
unwind. Test 143 now pins the exact wording rather than the prefix it shares
with the OS-less notice, and its control run skips the symbolizer it has no
reason to spawn.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>

* Declare the new backtrace test's Windows skip

The Windows job compares the skip set exactly, so a test that skips there for a
good reason still fails the gate until it is named.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>

---------

Signed-off-by: Xavier Roche <roche@httrack.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 18:22:08 +00:00

71 lines
2.1 KiB
Bash

#!/bin/bash
# An empty backtrace() must still leave a report; a silent one reads as a
# handler that died halfway.
set -euo pipefail
ulimit -c 0 # a deliberate crash must not litter the box with cores
if [ "$(uname -s)" != "Linux" ]; then
echo "LD_PRELOAD interposition is Linux-only here, skipping" >&2
exit 77
fi
command -v httrack >/dev/null || {
echo "could not find httrack" >&2
exit 1
}
# A --disable-shared build has nothing to preload; anything else missing is a
# build problem, not a skip, or the leg below would pass vacuously.
if [ ! -r "${NOBACKTRACE_LA:-}" ]; then
echo "${NOBACKTRACE_LA:-\$NOBACKTRACE_LA} was not built" >&2
exit 1
fi
if grep -q "^dlname=''" "$NOBACKTRACE_LA"; then
echo "static-only build, skipping" >&2
exit 77
fi
if [ ! -r "${NOBACKTRACE_LIB:-}" ]; then
echo "${NOBACKTRACE_LIB:-\$NOBACKTRACE_LIB} was not built" >&2
exit 1
fi
# An LD_PRELOAD library loads ahead of the executable's own libasan, which ASan
# refuses by default. The shim allocates nothing, so the ordering is harmless.
export ASAN_OPTIONS="${ASAN_OPTIONS:+$ASAN_OPTIONS:}verify_asan_link_order=0"
# Control: a build that never traces would pass the assertion below for the
# wrong reason.
rc=0
plain=$(HTTRACK_NO_SYMBOLIZE=1 httrack -#c=abort 2>&1) || rc=$? # no addr2line to wedge on
test "$rc" -eq 134 || {
echo "the plain crash exited $rc, not 134" >&2
exit 1
}
if grep -q 'No stack trace available' <<<"$plain"; then
echo "no working backtrace() in this build; skipping" >&2
exit 77
fi
rc=0
out=$(LD_PRELOAD="$NOBACKTRACE_LIB" httrack -#c=abort 2>&1) || rc=$?
test "$rc" -eq 134 || {
echo "the interposed crash exited $rc, not 134" >&2
printf '%s\n' "$out" >&2
exit 1
}
grep -q "^Caught signal 6$" <<<"$out" || {
echo "no 'Caught signal' line:" >&2
printf '%s\n' "$out" >&2
exit 1
}
grep -q 'No stack trace available: unwinding failed' <<<"$out" || {
echo "an empty backtrace left no diagnostic:" >&2
printf '%s\n' "$out" >&2
exit 1
}
grep -q "Please report the problem" <<<"$out" || {
echo "the handler stopped before its closing line:" >&2
printf '%s\n' "$out" >&2
exit 1
}