1
0
mirror of https://github.com/upx/upx.git synced 2025-08-07 22:46:51 +08:00

shell trap on ERR to help locate failing commands

modified:   misc/testsuite/mimic_ctest.sh
This commit is contained in:
John Reiser
2025-07-06 19:21:26 -07:00
parent 945d9157fa
commit 1fbd34035e

View File

@ -16,6 +16,12 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
#
# Debugging aid for locating failing commands. Depends on 'bash' shell.
# (BASH_LINENO is relative to current FUNCTION only; non-function ==> 0)
# Notice single-quoting of entire first argument.
trap 'echo ERROR: pwd=\"$PWD\" file=\"$BASH_SOURCE\" line=${BASH_LINENO[0]} cmd=\"$BASH_COMMAND\"' ERR
# Example: "false a b c" ==> ERROR: pwd="path/misc/testsuite" file="./mimic_ctest.sh" line=0 cmd="false a b c"
#***********************************************************************
# init & checks
#***********************************************************************