summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-10-23 13:00:51 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-10-23 13:00:51 -0400
commit63c43d7fb463529219a4de4d1fddb8953056346d (patch)
tree146032149f1698e334a83aa0ed713d51437ecc0b /tests
parentde8e0fbb8c1e59b3f1af72a07477b63a8f0bbc75 (diff)
downloadbfs-63c43d7fb463529219a4de4d1fddb8953056346d.tar.xz
tests: Clean up verbose logging a bit
Diffstat (limited to 'tests')
-rw-r--r--tests/run.sh56
1 files changed, 36 insertions, 20 deletions
diff --git a/tests/run.sh b/tests/run.sh
index d581476..f93cb4b 100644
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -239,25 +239,41 @@ bfs_verbose() {
}
bfs_verbose_impl() {
- printf "${GRN}%q${RST} " "${BFS[@]}"
+ printf "${GRN}%q${RST}" "${BFS[0]}"
+ if ((${#BFS[@]} > 1)); then
+ printf " ${GRN}%q${RST}" "${BFS[1:]}"
+ fi
- local expr_started=
+ local expr_started=0 color
for arg; do
- if [[ $arg == -[A-Z]* ]]; then
- printf "${CYN}%q${RST} " "$arg"
- elif [[ $arg == [\(!] || $arg == -[ao] || $arg == -and || $arg == -or || $arg == -not ]]; then
- expr_started=yes
- printf "${RED}%q${RST} " "$arg"
- elif [[ $expr_started && $arg == [\),] ]]; then
- printf "${RED}%q${RST} " "$arg"
- elif [[ $arg == -?* ]]; then
- expr_started=yes
- printf "${BLU}%q${RST} " "$arg"
- elif [ "$expr_started" ]; then
- printf "${BLD}%q${RST} " "$arg"
- else
- printf "${MAG}%q${RST} " "$arg"
- fi
+ case "$arg" in
+ -[A-Z]*|-[dsxf]|-j*)
+ color="${CYN}"
+ ;;
+ \(|!|-[ao]|-and|-or|-not|-exclude)
+ expr_started=1
+ color="${RED}"
+ ;;
+ \)|,)
+ if ((expr_started)); then
+ color="${RED}"
+ else
+ color="${MAG}"
+ fi
+ ;;
+ -?*)
+ expr_started=1
+ color="${BLU}"
+ ;;
+ *)
+ if ((expr_started)); then
+ color="${BLD}"
+ else
+ color="${MAG}"
+ fi
+ ;;
+ esac
+ printf " ${color}%q${RST}" "$arg"
done
printf '\n'
@@ -336,8 +352,8 @@ make_xattrs() {
EX_DIFF=20
# Detect colored diff support
-if ((COLOR_STDERR)) && diff --color=always /dev/null /dev/null 2>/dev/null; then
- DIFF="diff --color=always"
+if diff --color /dev/null /dev/null 2>/dev/null; then
+ DIFF="diff --color"
else
DIFF="diff"
fi
@@ -354,7 +370,7 @@ diff_output() {
if ((UPDATE)); then
cp "$OUT" "$GOLD"
else
- $DIFF -u "$GOLD" "$OUT" >&2
+ $DIFF -u "$GOLD" "$OUT" >&4
fi
}