summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-05-22 16:59:42 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-05-22 16:59:42 -0400
commitf48f8346ff96dc2183716104d5181b894451acc8 (patch)
tree99fdd91774c449360a242a146d4125eedf21e259
parent59b1c525c4c7c254dce702fca0fa472616a976d2 (diff)
downloadbfs-f48f8346ff96dc2183716104d5181b894451acc8.tar.xz
tests: Make hide_bar actually hide the bar
-rw-r--r--tests/color.sh15
-rw-r--r--tests/run.sh1
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/color.sh b/tests/color.sh
index ca85d28..4f4312e 100644
--- a/tests/color.sh
+++ b/tests/color.sh
@@ -70,6 +70,7 @@ print_bar() {
# Hide the terminal status bar
hide_bar() {
+ printf 'HIDE:%d:\0' $$ >&$BAR
exec {BAR}>&-
unset BAR
}
@@ -111,6 +112,20 @@ bar_proc() {
PRINT)
printf '\e7\e[%d;0f\e[K%s\e8' $((TTY_HEIGHT - bar)) "$str"
;;
+ HIDE)
+ bar="${pid2bar[$pid]}"
+ # Delete this status bar
+ unset 'pid2bar[$pid]'
+ # Shift all higher status bars down
+ for i in "${!pid2bar[@]}"; do
+ ibar="${pid2bar[$i]}"
+ if ((ibar > bar)); then
+ pid2bar["$i"]=$((ibar - 1))
+ fi
+ done
+ ((BAR_HEIGHT--))
+ resize_bar
+ ;;
esac
done
}
diff --git a/tests/run.sh b/tests/run.sh
index 87f94b4..381b03e 100644
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -207,7 +207,6 @@ run_tests() {
done
if [ "${BAR:-}" ]; then
- progress "${YLW}[100%%]${RST} ${BLD}%3d${RST} / ${BLD}%d${RST}\n" $ran $total
hide_bar
fi