diff --git a/src/tests/e2e-test b/src/tests/e2e-test index ee0dcd2..65c62af 100755 --- a/src/tests/e2e-test +++ b/src/tests/e2e-test @@ -57,42 +57,6 @@ test_exitstatus() } -# Tmux check. -tmux_check() -{ - # OpenBSD tmux does not have '-V'. - if [ "$(uname -s)" = "OpenBSD" ]; then - openbsd_major="$(uname -r)" - openbsd_major="${openbsd_major%%.*}" - if [ "${openbsd_major}" -ge 6 ]; then - return 0 - fi - fi - version=$(tmux -V) - if [ $? != 0 ]; then - error "tmux unavailable\n" - return 1 - fi - if [ "$version" = "tmux master" ]; then - return 0 - fi - version=${version##tmux } - version_major=${version%%.*} - version_minor=${version##*.} - # need version 1.8 for capture-pane - if [ "$version_major" -lt 1 ] || - { [ "$version_major" -eq 1 ] && [ "$version_minor" -lt 8 ]; }; then - error "tmux version %s too old\n" "$version" - return 1 - fi - # Finally, check that tmux actually works to some degree. - # - # Use a different socket name. On Cygwin, this tmux server is - # slow to exit, and the actual test tmux can attach to it, causing - # problems with missing environment variables. - tmux -f /dev/null -S "${tmux_socket}c" -C new-session true -} - ssh_localhost_check() { ssh localhost : @@ -169,7 +133,8 @@ fi # XXX this ignores $TMPDIR, because it results in an overlong pathname on OS X tmux_socket="/tmp/.tmux-mosh-test-$$" -if ! tmux_check; then +# need version 1.8 for capture-pane +if ! tmux_check 1 8; then test_skipped "tmux unavailable\n" fi diff --git a/src/tests/e2e-test-subrs b/src/tests/e2e-test-subrs index 958c9b7..b033ed8 100644 --- a/src/tests/e2e-test-subrs +++ b/src/tests/e2e-test-subrs @@ -80,3 +80,41 @@ set_locale() # Fail. return 1 } + +# Tmux check. +tmux_check() +{ + need_major="$1"; shift + need_minor="$1"; shift + # OpenBSD tmux does not have '-V'. + if [ "$(uname -s)" = "OpenBSD" ]; then + openbsd_major="$(uname -r)" + openbsd_major="${openbsd_major%%.*}" + if [ "${openbsd_major}" -ge 6 ]; then + return 0 + fi + fi + version=$(tmux -V) + if [ $? != 0 ]; then + error "tmux unavailable\n" + return 1 + fi + if [ "$version" = "tmux master" ]; then + return 0 + fi + version=${version##tmux } + version_major=${version%%.*} + version_minor=${version##*.} + + if [ "$version_major" -lt "$need_major" ] || + { [ "$version_major" -eq "$need_major" ] && [ "$version_minor" -lt "$need_minor" ]; }; then + printf "tmux version %s too old\n" "$version" >&2 + return 1 + fi + # Finally, check that tmux actually works to some degree. + # + # Use a different socket name. On Cygwin, this tmux server is + # slow to exit, and the actual test tmux can attach to it, causing + # problems with missing environment variables. + tmux -f /dev/null -S "${tmux_socket}c" -C new-session true +} diff --git a/src/tests/emulation-attributes.test b/src/tests/emulation-attributes.test index e633f5c..dbc413c 100755 --- a/src/tests/emulation-attributes.test +++ b/src/tests/emulation-attributes.test @@ -14,6 +14,13 @@ # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir +# Need 2.3 for true-color support (2.2 may work also) +if [ "$(basename "$0")" = emulation-attributes-truecolor.test ] && + ! tmux_check 2 3; then + printf "tmux does not support true color\n" >&2 + exit 77 +fi + # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify