From a0afc0df3804372568fb7a0a5b083d7281fa7b70 Mon Sep 17 00:00:00 2001
From: a1346054 <36859588+a1346054@users.noreply.github.com>
Date: Sat, 14 Aug 2021 12:12:24 +0000
Subject: [PATCH 1/5] ruby-based installer was replaced by bash-based
Taken straight from homebrew homepage at https://brew.sh/
---
macosx/brew-deps.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/macosx/brew-deps.sh b/macosx/brew-deps.sh
index 5a7c14545..b8cb93386 100755
--- a/macosx/brew-deps.sh
+++ b/macosx/brew-deps.sh
@@ -19,7 +19,7 @@ install()
{
# Straight from https://brew.sh
if ! brew --version > /dev/null 2>&1; then
- /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
}
From eb5ba1bf9042f15dca2dc3b09d90b81bc4f5befb Mon Sep 17 00:00:00 2001
From: a1346054 <36859588+a1346054@users.noreply.github.com>
Date: Sat, 14 Aug 2021 12:15:56 +0000
Subject: [PATCH 2/5] use identical license file distributed by GNU
Downloaded from https://www.gnu.org/licenses/gpl-3.0.txt
---
COPYING | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/COPYING b/COPYING
index 94a9ed024..f288702d2 100644
--- a/COPYING
+++ b/COPYING
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
-.
+.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
-.
+.
From c5ad947a1b0aaf60ca308b06741405407fc2e560 Mon Sep 17 00:00:00 2001
From: a1346054 <36859588+a1346054@users.noreply.github.com>
Date: Fri, 15 Jul 2022 22:54:52 +0000
Subject: [PATCH 3/5] use `grep -E` instead of `egrep`
---
src/tests/e2e-test | 4 ++--
src/tests/prediction-unicode.test | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/tests/e2e-test b/src/tests/e2e-test
index c0e9d27d0..8c8939d12 100755
--- a/src/tests/e2e-test
+++ b/src/tests/e2e-test
@@ -244,13 +244,13 @@ for run in $server_tests; do
test_error "Round-trip Instruction verification failed on server during %s\n" "$run"
fi
# Check for 0-timeout select() issue
- if egrep -q "(polls, rate limiting|consecutive polls)" "${test_dir}/${run}.server.stderr"; then
+ if grep -E -q "(polls, rate limiting|consecutive polls)" "${test_dir}/${run}.server.stderr"; then
if [ "osx" != "${TRAVIS_OS_NAME}" ]; then
test_error "select() with zero timeout called too often on server during %s\n" "$run"
fi
fi
# Check for assert()
- if egrep -q "assertion.*failed" "${test_dir}/${run}.server.stderr"; then
+ if grep -E -q "assertion.*failed" "${test_dir}/${run}.server.stderr"; then
test_error "assertion during %s\n" "$run"
fi
fi
diff --git a/src/tests/prediction-unicode.test b/src/tests/prediction-unicode.test
index bbb675c09..6234d18e4 100755
--- a/src/tests/prediction-unicode.test
+++ b/src/tests/prediction-unicode.test
@@ -76,7 +76,7 @@ post()
unset LC_ALL
unset LC_CTYPE
unset LANGUAGE
- ! env LANG=C egrep -q "%output %0 (\)|$(printf \\374))" "$(basename "$0").d/baseline.tmux.log"
+ ! env LANG=C grep -E -q "%output %0 (\)|$(printf \\374))" "$(basename "$0").d/baseline.tmux.log"
# Implicit exitcode return.
)
return $?
From 376214ac2c5d0d18675e18c6d71498f634ea7e83 Mon Sep 17 00:00:00 2001
From: a1346054 <36859588+a1346054@users.noreply.github.com>
Date: Sat, 14 Aug 2021 12:26:33 +0000
Subject: [PATCH 4/5] fix shellcheck warnings in scripts
---
appveyor.sh | 50 -----------------
appveyor.yml | 54 -------------------
macosx/build.sh | 2 +-
scripts/wrap-compiler-for-flag-check | 2 +-
src/tests/e2e-failure.test | 4 +-
src/tests/e2e-success.test | 4 +-
src/tests/e2e-test | 20 +++----
src/tests/e2e-test-server | 20 +++----
src/tests/e2e-test-subrs | 10 ++--
src/tests/emulation-80th-column.test | 4 +-
src/tests/emulation-ascii-iso-8859.test | 4 +-
src/tests/emulation-attributes.test | 18 +++----
src/tests/emulation-back-tab.test | 4 +-
src/tests/emulation-cursor-motion.test | 4 +-
src/tests/emulation-multiline-scroll.test | 4 +-
src/tests/emulation-scroll.test | 4 +-
src/tests/emulation-wrap-across-frames.test | 4 +-
src/tests/network-no-diff.test | 6 +--
src/tests/prediction-unicode.test | 4 +-
src/tests/pty-deadlock.test | 8 +--
src/tests/repeat.test | 12 ++---
src/tests/server-network-timeout.test | 10 ++--
.../unicode-combine-fallback-assert.test | 4 +-
src/tests/unicode-later-combining.test | 4 +-
src/tests/window-resize.test | 2 +-
25 files changed, 79 insertions(+), 183 deletions(-)
delete mode 100755 appveyor.sh
delete mode 100644 appveyor.yml
diff --git a/appveyor.sh b/appveyor.sh
deleted file mode 100755
index 11fc06798..000000000
--- a/appveyor.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-#
-# Cleanup for Appveyor peculiarities.
-#
-
-# Echo, eval, and error on shell commands.
-eeval()
-{
- echo "$0: $*" >&2
- eval "$@"
- rv=$?
- if [ $rv -ne 0 ]; then
- echo "$0: failed, exitcode $rv"
- exit $rv
- fi
- return 0
-}
-
-# We inherit a broken Windows path with a Windows Git.
-PATH=/bin
-
-# This supposedly fixes some failures.
-exec 0&1); then
else
code=$?
echo "$out"
- exit $code
+ exit "$code"
fi
diff --git a/src/tests/e2e-failure.test b/src/tests/e2e-failure.test
index 038529526..02a267a48 100755
--- a/src/tests/e2e-failure.test
+++ b/src/tests/e2e-failure.test
@@ -4,13 +4,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline variant different
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/e2e-success.test b/src/tests/e2e-success.test
index 3225e76bf..bb64df995 100755
--- a/src/tests/e2e-success.test
+++ b/src/tests/e2e-success.test
@@ -4,13 +4,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline direct variant verify same
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/e2e-test b/src/tests/e2e-test
index 8c8939d12..446d3d760 100755
--- a/src/tests/e2e-test
+++ b/src/tests/e2e-test
@@ -22,7 +22,7 @@ dump_logs()
dir=$1
shift
testname=$(basename "$dir" .d)
- for logfile in $dir/*.tmux.log; do
+ for logfile in "$dir"/*.tmux.log; do
printf "travis_fold:start:%s-%s\n" "$testname" "$(basename "$logfile")"
cat "$logfile"
printf "travis_fold:end:%s-%s\n" "$testname" "$(basename "$logfile")"
@@ -60,7 +60,7 @@ test_exitstatus()
ssh_localhost_check()
{
ssh localhost :
- if [ $? -ne 0 ]; then
+ if [ "$?" -ne 0 ]; then
error "ssh to localhost failed\n"
return 1
fi
@@ -93,7 +93,7 @@ if [ -z "$srcdir" ]; then
export srcdir=$PWD
else
srcdir="$(cd "$srcdir" && pwd)"
- if [ $? -ne 0 ]; then
+ if [ "$?" -ne 0 ]; then
error "can't cd to srcdir: %s\n" "$srcdir"
exit 99
fi
@@ -113,7 +113,7 @@ case "$(basename "$0")" in
;;
esac
-if [ $# -lt 2 ]; then
+if [ "$#" -lt 2 ]; then
test_error "not enough args\n"
fi
@@ -144,10 +144,10 @@ mkdir "${test_dir}"
on_exit() {
rv=$?
- if test $rv -ne 0; then
+ if test "$rv" -ne 0; then
dump_logs "$test_dir" $test_args
fi
- exit $rv
+ exit "$rv"
}
trap on_exit EXIT
@@ -219,7 +219,7 @@ for run in $server_tests; do
${tmux_stdin} tmux -f /dev/null -S "${tmux_socket}" -C new-session -x 80 -y 24 "${srcdir}/print-exitstatus ${client_wrapper} ${sut} ${server_wrapper} \"${PWD}/${test_dir}/${run}\" \"${PWD}/${test_script} ${run}\"" > "${test_dir}/${run}.tmux.log"
rv=$?
rm -f "${tmux_socket}" "${test_dir}/tmux-socket"
- if [ $rv -ne 0 ]; then
+ if [ "$rv" -ne 0 ]; then
test_error "tmux failure on test %s\n" "$run"
fi
# Check for mosh failures
@@ -282,7 +282,7 @@ for compare in $compare_tests; do
desired=n
badresult=different
fi
- if [ $differ != $desired ]; then
+ if [ "$differ" != "$desired" ]; then
test_failure "Output is %s between tests %s and %s\n" "$badresult" "$test1" "$test2"
fi
done
@@ -291,7 +291,7 @@ done
if [ -n "$post" ]; then
"${test_script}" post
status=$?
- if [ $status -ne 0 ]; then
- test_exitstatus $status "Post test failed with exitstatus %d\n" $status
+ if [ "$status" -ne 0 ]; then
+ test_exitstatus "$status" "Post test failed with exitstatus %d\n" "$status"
fi
fi
diff --git a/src/tests/e2e-test-server b/src/tests/e2e-test-server
index fc6d15a00..9228d7d6c 100755
--- a/src/tests/e2e-test-server
+++ b/src/tests/e2e-test-server
@@ -17,11 +17,11 @@ wait_for_clients()
expected=$1
while true; do
n=$(tmux list-clients -F . | wc -l)
- if [ $expected -eq 1 ]; then
- if [ $n -eq 1 ]; then
+ if [ "$expected" -eq 1 ]; then
+ if [ "$n" -eq 1 ]; then
return
fi
- elif [ $n -ne 1 ]; then
+ elif [ "$n" -ne 1 ]; then
return
fi
sleep 1
@@ -30,7 +30,7 @@ wait_for_clients()
export MOSH_SERVER_PID=$PPID
-if [ $# -lt 2 ]; then
+if [ "$#" -lt 2 ]; then
printf "not enough args\n" >&2
exit 99
fi
@@ -40,8 +40,8 @@ rm -f "$testname.capture" "$testname.exitstatus"
trap ":" TERM HUP QUIT # If the session closes on us, let the test we're running drive.
on_exit() {
rv=$?
- echo $rv > "$testname.exitstatus"
- exit $rv
+ echo "$rv" > "$testname.exitstatus"
+ exit "$rv"
}
trap on_exit EXIT
# check for tmux
@@ -55,7 +55,7 @@ eval "$@"
testret=$?
# Capture mosh-server runtime if possible.
runtime=$(ps -o time= $PPID 2>/dev/null)
-if [ $? -ne 0 ]; then # Cygwin...
+if [ "$?" -ne 0 ]; then # Cygwin...
runtime=-
fi
# Wait for tmux client screen to become up to date.
@@ -63,14 +63,14 @@ sleep 1
printf "@@@ server complete @@@" >&2
wait_for_clients 1
i=0
-while [ $i -lt 60 ]; do
+while [ "$i" -lt 60 ]; do
if grep -q "@@@ server complete @@@" "$testname.tmux.log"; then
break
fi
i=$((i+1))
sleep 1
done
-if [ $i -ge 60 ]; then
+if [ "$i" -ge 60 ]; then
printf "wait for tmux client update failed, erroring test\n" >&2
exit 99
fi
@@ -86,7 +86,7 @@ fi
# Dump runtime into tmux log.
printf "@@@ runtime %s @@@\n" "$runtime"
# return useful exitstatus from harnessed command
-if [ $testret -ne 0 ]; then
+if [ "$testret" -ne 0 ]; then
exit 1
fi
exit 0
diff --git a/src/tests/e2e-test-subrs b/src/tests/e2e-test-subrs
index 8f2054bae..de8b98358 100644
--- a/src/tests/e2e-test-subrs
+++ b/src/tests/e2e-test-subrs
@@ -23,7 +23,7 @@ sleepf()
seq_function()
{
- if [ $# -lt 1 ] || [ $# -gt 3 ]; then
+ if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then
echo "bad args" >&2
fi
first=$1
@@ -95,7 +95,7 @@ tmux_check()
fi
fi
version=$(tmux -V)
- if [ $? != 0 ]; then
+ if [ "$?" != 0 ]; then
error "tmux unavailable\n"
return 1
fi
@@ -119,7 +119,7 @@ tmux_check()
tmux_check_socket=$(mktemp -d /tmp/mosh-tmux-check.XXXXXXXX)
tmux -f /dev/null -S "${tmux_check_socket}/s" -C new-session true
rv=$?
- rm ${tmux_check_socket}/s
- rmdir ${tmux_check_socket}
- return $rv
+ rm "${tmux_check_socket}/s"
+ rmdir "${tmux_check_socket}"
+ return "$rv"
}
diff --git a/src/tests/emulation-80th-column.test b/src/tests/emulation-80th-column.test
index b33cc442c..9ef82a589 100755
--- a/src/tests/emulation-80th-column.test
+++ b/src/tests/emulation-80th-column.test
@@ -12,13 +12,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline post
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/emulation-ascii-iso-8859.test b/src/tests/emulation-ascii-iso-8859.test
index b50a00188..911192c64 100755
--- a/src/tests/emulation-ascii-iso-8859.test
+++ b/src/tests/emulation-ascii-iso-8859.test
@@ -8,13 +8,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline direct verify
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/emulation-attributes.test b/src/tests/emulation-attributes.test
index e4ba2f3fe..c0591dc41 100755
--- a/src/tests/emulation-attributes.test
+++ b/src/tests/emulation-attributes.test
@@ -15,33 +15,33 @@
. "$(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 ] &&
+if [ "$(basename "$0")" = "emulation-attributes-truecolor.test" ] &&
! tmux_check 2 3; then
printf "tmux does not support true color\n" >&2
exit 77
fi
# Need 2.4 for BCE support
-if [ "$(basename "$0")" = emulation-attributes-bce.test ] &&
+if [ "$(basename "$0")" = "emulation-attributes-bce.test" ] &&
! tmux_check 2 4; then
printf "tmux does not support BCE\n" >&2
exit 77
fi
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline direct verify
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
test_true_color()
{
s=$(printf "\033[0")
- for i in $@; do
+ for i in "$@"; do
s="$s;$i"
done
s="${s}m"
@@ -50,7 +50,7 @@ test_true_color()
r=$((255-(attr*255/76)))
g=$((attr*510/76))
b=$((attr*255/76))
- if [ $g -gt 255 ]; then
+ if [ "$g" -gt 255 ]; then
g=$((510-g))
fi
invr=$((255-r))
@@ -59,8 +59,8 @@ test_true_color()
c="E"
printf "%s" "$s"
- printf "\033[48;2;%d;%d;%dm" $r $g $b;
- printf "\033[38;2;%d;%d;%dm" $invr $invg $invb
+ printf "\033[48;2;%d;%d;%dm" "$r" "$g" "$b";
+ printf "\033[38;2;%d;%d;%dm" "$invr" "$invg" "$invb"
printf "%s\033[m" "$c"
done
printf "\n"
@@ -80,7 +80,7 @@ baseline()
# Traditional ancient VT100 attributes.
vt100)
for attr in 0 1 4 5 7; do
- printf '\033[%dmE\033[m ' $attr
+ printf '\033[%dmE\033[m ' "$attr"
done
;;
# 16-color attributes.
diff --git a/src/tests/emulation-back-tab.test b/src/tests/emulation-back-tab.test
index 3b24357a4..62bee4c66 100755
--- a/src/tests/emulation-back-tab.test
+++ b/src/tests/emulation-back-tab.test
@@ -8,13 +8,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline post
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/emulation-cursor-motion.test b/src/tests/emulation-cursor-motion.test
index 40ea8b9f7..aadb3d5a4 100755
--- a/src/tests/emulation-cursor-motion.test
+++ b/src/tests/emulation-cursor-motion.test
@@ -9,13 +9,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline direct verify
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/emulation-multiline-scroll.test b/src/tests/emulation-multiline-scroll.test
index af0309a0e..43424391b 100755
--- a/src/tests/emulation-multiline-scroll.test
+++ b/src/tests/emulation-multiline-scroll.test
@@ -11,13 +11,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/emulation-scroll.test b/src/tests/emulation-scroll.test
index 1656cadd3..02bbdffda 100755
--- a/src/tests/emulation-scroll.test
+++ b/src/tests/emulation-scroll.test
@@ -10,13 +10,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline post
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/emulation-wrap-across-frames.test b/src/tests/emulation-wrap-across-frames.test
index 576041840..69eeb68db 100755
--- a/src/tests/emulation-wrap-across-frames.test
+++ b/src/tests/emulation-wrap-across-frames.test
@@ -13,13 +13,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline direct verify
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/network-no-diff.test b/src/tests/network-no-diff.test
index 8aa4f15ad..93adc6179 100755
--- a/src/tests/network-no-diff.test
+++ b/src/tests/network-no-diff.test
@@ -9,13 +9,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline post
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
@@ -23,7 +23,7 @@ baseline()
{
# Generate updates that don't change the screen
i=0
- while [ $i -lt 10 ] && printf 'x\b' && sleep 1; do
+ while [ "$i" -lt 10 ] && printf 'x\b' && sleep 1; do
i=$((i + 1))
done
}
diff --git a/src/tests/prediction-unicode.test b/src/tests/prediction-unicode.test
index 6234d18e4..ce4659782 100755
--- a/src/tests/prediction-unicode.test
+++ b/src/tests/prediction-unicode.test
@@ -29,7 +29,7 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" tmux baseline mosh-args post
exit
fi
@@ -79,7 +79,7 @@ post()
! env LANG=C grep -E -q "%output %0 (\)|$(printf \\374))" "$(basename "$0").d/baseline.tmux.log"
# Implicit exitcode return.
)
- return $?
+ return "$?"
}
case $1 in
diff --git a/src/tests/pty-deadlock.test b/src/tests/pty-deadlock.test
index 219eca947..933bc8e72 100755
--- a/src/tests/pty-deadlock.test
+++ b/src/tests/pty-deadlock.test
@@ -15,7 +15,7 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" tmux baseline post
exit
fi
@@ -59,10 +59,10 @@ baseline()
:
done &
printpid=$!
- (sleep 120; kill $$ $printpid) &
+ (sleep 120; kill "$$" "$printpid") &
killpid=$!
read -r x
- kill $printpid
+ kill "$printpid"
# Try and make sure the printer stops writing before the following printf
sleep 1
printf "\n=== normal exit ===\n"
@@ -70,7 +70,7 @@ baseline()
# before we exit
sleep 4
# Kill the killer and exit normally.
- kill $killpid
+ kill "$killpid"
}
post()
diff --git a/src/tests/repeat.test b/src/tests/repeat.test
index 7830c8e81..deb367dba 100755
--- a/src/tests/repeat.test
+++ b/src/tests/repeat.test
@@ -15,7 +15,7 @@
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
do_tmux=
case $(basename "$0" .test) in
repeat-with-input)
@@ -28,15 +28,15 @@ fi
# Run mosh repeatedly
client()
{
- for i in $(seq 1 $REPEAT_TEST_LOOPCOUNT); do
- (sleep 15; kill $$) &
+ for i in $(seq 1 "$REPEAT_TEST_LOOPCOUNT"); do
+ (sleep 15; kill "$$") &
killpid=$!
if ! "$@"; then
printf "### iteration %d failed\n" "$i"
- kill $killpid
+ kill "$killpid"
exit 1
fi
- kill $killpid
+ kill "$killpid"
done
}
@@ -69,7 +69,7 @@ baseline()
post()
{
- if [ "$(grep -c "@@@ done" "$(basename "$0").d/baseline.tmux.log")" -lt $REPEAT_TEST_LOOPCOUNT ]; then
+ if [ "$(grep -c "@@@ done" "$(basename "$0").d/baseline.tmux.log")" -lt "$REPEAT_TEST_LOOPCOUNT" ]; then
exit 1
fi
}
diff --git a/src/tests/server-network-timeout.test b/src/tests/server-network-timeout.test
index 5de601d54..d28ecfe66 100755
--- a/src/tests/server-network-timeout.test
+++ b/src/tests/server-network-timeout.test
@@ -18,7 +18,7 @@ TIMEOUT=10
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" client baseline
exit
fi
@@ -48,11 +48,11 @@ client()
fail "mosh-client had a normal exit\n";; # test condition failed
9|137|265)
# Aha, signal 9. Wait.
- sleep $(( TIMEOUT + 12 ))
+ sleep "$(( TIMEOUT + 12 ))"
exit 0
;;
*)
- fail "unknown client wrapper failure, retval=%d\n" $retval
+ fail "unknown client wrapper failure, retval=%d\n" "$retval"
;;
esac
fail "client wrapper shouldnt get here\n"
@@ -82,11 +82,11 @@ baseline()
case "$myname" in
server-network-timeout)
# Just wait. This is the hardest part.
- sleep $(( TIMEOUT + 7 ))
+ sleep "$(( TIMEOUT + 7 ))"
;;
server-signal-timeout)
# Wait for the timeout to expire.
- sleep $(( TIMEOUT + 2 ))
+ sleep "$(( TIMEOUT + 2 ))"
# Tell the server to go away.
kill -USR1 "$MOSH_SERVER_PID"
sleep 5
diff --git a/src/tests/unicode-combine-fallback-assert.test b/src/tests/unicode-combine-fallback-assert.test
index 4185e0248..1324613fd 100755
--- a/src/tests/unicode-combine-fallback-assert.test
+++ b/src/tests/unicode-combine-fallback-assert.test
@@ -12,13 +12,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/unicode-later-combining.test b/src/tests/unicode-later-combining.test
index a1ca0ad3f..5fa673d54 100755
--- a/src/tests/unicode-later-combining.test
+++ b/src/tests/unicode-later-combining.test
@@ -18,13 +18,13 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" baseline post
exit
fi
# OK, we have arguments, we're one of the test hooks.
-if [ $# -ne 1 ]; then
+if [ "$#" -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
diff --git a/src/tests/window-resize.test b/src/tests/window-resize.test
index a31025e93..8fcd2aec5 100755
--- a/src/tests/window-resize.test
+++ b/src/tests/window-resize.test
@@ -10,7 +10,7 @@
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
-if [ $# -eq 0 ]; then
+if [ "$#" -eq 0 ]; then
e2e-test "$0" tmux baseline
exit
fi
From 9070faf32607ebd55c88d2a8dc391f05da3f77ec Mon Sep 17 00:00:00 2001
From: a1346054 <36859588+a1346054@users.noreply.github.com>
Date: Fri, 15 Jul 2022 23:06:59 +0000
Subject: [PATCH 5/5] fix typos
---
src/tests/README.md | 2 +-
src/tests/pty-deadlock.test | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/tests/README.md b/src/tests/README.md
index 0f59f5f1c..ee9a64241 100644
--- a/src/tests/README.md
+++ b/src/tests/README.md
@@ -83,7 +83,7 @@ actions, which are expected to be identical.
actions, which are expected to be different.
`post` is a catchall script hook which allows custom verification
-acions to be coded.
+actions to be coded.
### Client wrappers
diff --git a/src/tests/pty-deadlock.test b/src/tests/pty-deadlock.test
index 933bc8e72..292d48429 100755
--- a/src/tests/pty-deadlock.test
+++ b/src/tests/pty-deadlock.test
@@ -33,7 +33,7 @@ tmux_commands()
# Restart output...
printf "send-keys 0x11\n"
sleep 10
- # And stop the test script, so it produces its exit messge.
+ # And stop the test script, so it produces its exit message.
printf "send-keys 0x0d\n"
# This will get killed by SIGPIPE.
while printf "show-options\n" && sleep 1; do