Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2020-05-16 01:45:07 +0300
committerBryan Drewery <bryan@shatow.net>2022-11-09 22:10:45 +0300
commit598f06f347ec4a975d89e2c73d4269bb0b56a0f0 (patch)
tree98a6bacd5dc2382ab90e92ace2f134ab79fcd80e
parent23b7a4328e89b536304c986071bd586232250bcb (diff)
test asserts: Show pid of caller
-rw-r--r--test/common.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/common.sh b/test/common.sh
index 0e61b4fb..c5854c45 100644
--- a/test/common.sh
+++ b/test/common.sh
@@ -185,6 +185,9 @@ aecho() {
[ $# -ge 2 ] || eargs aecho result lineinfo expected actual msg
local result="$1"
local lineinfo="$2"
+ local mypid
+
+ : ${mypid:=$(sh -c 'echo $PPID')}
if [ "$#" -gt 3 ]; then
# Failure
@@ -193,15 +196,15 @@ aecho() {
local INDENT
shift 4
INDENT=">> "
- printf "> %-4s %s: %s\n${INDENT}expected '%s'\n${INDENT}actual '%s'\n" \
- "${result}" "${lineinfo}" \
+ printf "%d> %-4s %s: %s\n${INDENT}expected '%s'\n${INDENT}actual '%s'\n" \
+ "${mypid}" "${result}" "${lineinfo}" \
"$(echo "$@" | cat -ev | sed '2,$s,^, ,')" \
"$(echo "${expected}" | cat -ev | sed '2,$s,^, ,')" \
"$(echo "${actual}" | cat -ev | sed '2,$s,^, ,')"
elif [ "$#" -eq 3 ]; then
printf "> %-4s %s: %s\n" "${result}" "${lineinfo}" "${3}"
else
- printf "> %-4s %s\n" "${result}" "${lineinfo}"
+ printf "%d> %-4s %s\n" "${mypid}" "${result}" "${lineinfo}"
fi >&2
}