aboutsummaryrefslogtreecommitdiff
path: root/tmuxrdr/scripts/test-e2e
diff options
context:
space:
mode:
Diffstat (limited to 'tmuxrdr/scripts/test-e2e')
-rwxr-xr-xtmuxrdr/scripts/test-e2e15
1 files changed, 12 insertions, 3 deletions
diff --git a/tmuxrdr/scripts/test-e2e b/tmuxrdr/scripts/test-e2e
index 5913afa8..7c82086e 100755
--- a/tmuxrdr/scripts/test-e2e
+++ b/tmuxrdr/scripts/test-e2e
@@ -13,7 +13,8 @@
# the throwaway pane -- printed, never run -- and is skipped when the
# clipboard holds no text.
#
-# HERDR=path/to/herdr test another binary, e.g. a tmuxrdr build
+# HERDR=path/to/binary test another tmuxrdr build than the installed
+# tmuxrdr, e.g. target/release/herdr
# TMUXRDR_E2E_DELAY=1.2 seconds after each key (default 0.8); raise it on
# a loaded machine before suspecting a failure
#
@@ -22,7 +23,7 @@
set -uo pipefail
repo="$(cd "$(dirname "$0")/../.." && pwd -P)"
-herdr="${HERDR:-herdr}"
+herdr="${HERDR:-tmuxrdr}"
delay="${TMUXRDR_E2E_DELAY:-0.8}"
session="tmuxrdr-e2e-$$"
T=(tmux -L "tmuxrdr-e2e-$$" -f /dev/null)
@@ -30,7 +31,7 @@ H=("$herdr" --session "$session")
plugin_id="tmuxrdr.tmux-mode"
work="$(mktemp -d)"
cfg="$work/config.toml"
-state="${XDG_STATE_HOME:-$HOME/.local/state}/herdr/plugins/$plugin_id/$session"
+state="" # set once the binary's directory name is known, below
pass=0 fail=0 skip=0
@@ -49,6 +50,11 @@ die() { >&2 echo "ERROR: $*"; exit 2; }
for tool in tmux jq "$herdr"; do
command -v "$tool" >/dev/null || die "$tool not found"
done
+# The binary's own directory name -- tmuxrdr for a tmuxrdr build -- from the
+# config path it reports; plugin state lives under the same name.
+app="$(basename "$(dirname "$("$herdr" --help | sed -n 's/^Config: *//p')")")"
+[[ "$app" == tmuxrdr ]] || die "$herdr keeps its files under '$app', not tmuxrdr: not a tmuxrdr build"
+state="${XDG_STATE_HOME:-$HOME/.local/state}/$app/plugins/$plugin_id/$session"
"$herdr" plugin list --json 2>/dev/null \
| jq -e --arg id "$plugin_id" --arg root "$repo/tmuxrdr/plugin" \
'[.. | objects | select(.plugin_id? == $id and .plugin_root? == $root)] | length > 0' >/dev/null \
@@ -107,6 +113,9 @@ done
[[ "$(focus 2>/dev/null)" == w1:p1 ]] || die "herdr client did not come up"
echo "herdr $("$herdr" --version | awk '{print $2}'), session $session, config copy of tmuxrdr/config/config.toml"
+check 'config check: no unknown keys or bad bindings' \
+ "$(HERDR_CONFIG_PATH="$cfg" "$herdr" config check 2>&1 | head -n 1)" "config: ok"
+
# --- panes -------------------------------------------------------------------
k C-b %; check 'prefix+% split side by side' "$(tab_panes)" 2