Skip to content

Commit

Permalink
tmux-uitest.sh: debug failed sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Oct 15, 2020
1 parent 1b27612 commit 7798f27
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/libyui/tmux-uitest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
SESSION=uitest
: "${VERBOSE=false}"

# $@ commands
# $1 shell command for sh -c
tmux_new_session() {
if $VERBOSE; then
echo Starting session
fi
# -s session name
# -x width -y height,
# -d detached
tmux new-session -s "$SESSION" -x 80 -y 24 -d "$@"
# FIXME: sleep to be able to see errors when running $1
tmux new-session -s "$SESSION" -x 80 -y 24 -d sh -c "$1; sleep 9999"
}

# A --quiet grep
Expand Down Expand Up @@ -47,10 +48,15 @@ tmux_await() {
false
}

# capture the session to stdout
tmux_capture_pane() {
tmux capture-pane -t "$SESSION" -p
}

# $1
# $1.txt plain text
# $1.esc text with escape sequences for colors
tmux_capture_pane() {
tmux_capture_pane_to() {
local OUT="$1"

# -t target-pane, -p to stdout,
Expand All @@ -74,6 +80,9 @@ tmux_send_keys() {
# usage: trap tmux_cleanup EXIT
tmux_cleanup() {
if tmux_has_session; then
echo SCREEN BEGIN
tmux_capture_pane
echo SCREEN END
tmux_kill_session
fi
}
Expand Down

0 comments on commit 7798f27

Please sign in to comment.