summaryrefslogtreecommitdiffstats
path: root/tests/util.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-02-01 12:11:41 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-02-03 13:50:08 -0500
commit4d0d84f935159c395ccf3b95d5727a3553003b68 (patch)
treeb2db29ab66d4ac6d88ee9f1e94598e34996718f2 /tests/util.sh
parentc4334184502c25a41b5cab060681229b2b570c0a (diff)
downloadbfs-4d0d84f935159c395ccf3b95d5727a3553003b68.tar.xz
tests: Implement jobserver inheritance
Diffstat (limited to 'tests/util.sh')
-rw-r--r--tests/util.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/util.sh b/tests/util.sh
index ec24958..7dba9fb 100644
--- a/tests/util.sh
+++ b/tests/util.sh
@@ -113,9 +113,13 @@ callers() {
# Print a message including path, line number, and command
debug() {
- local file="${1/#*\/tests\//tests/}"
- set -- "$file" "${@:2}"
- color printf "${BLD}%s:%d:${RST} %s\n %s\n" "$@"
+ local file="$1"
+ local line="$2"
+ local msg="$3"
+ local cmd="$(awk "NR == $line" "$file" 2>/dev/null)" || :
+ file="${file/#*\/tests\//tests/}"
+
+ color printf "${BLD}%s:%d:${RST} %s\n %s\n" "$file" "$line" "$msg" "$cmd"
}
## Deferred cleanup
@@ -163,7 +167,7 @@ pop_defer() {
eval "$cmd" || ret=$?
if ((ret != 0)); then
- debug "$file" $line "${RED}error $ret${RST}" "defer $cmd" >&$DUPERR
+ debug "$file" $line "${RED}error $ret${RST}" >&$DUPERR
fi
return $ret