summaryrefslogtreecommitdiffstats
path: root/debian/tests/t
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/tests/t/boilerplate.sh51
-rw-r--r--debian/tests/t/bug-600246.txt1
-rw-r--r--debian/tests/t/bug-677512.txt1
-rw-r--r--debian/tests/t/bug-982435-CVE-2021-26937.crash1
-rw-r--r--debian/tests/t/bug-982435-CVE-2021-26937.t18
-rwxr-xr-xdebian/tests/t/command.t17
-rwxr-xr-xdebian/tests/t/create-list-quit.t9
-rwxr-xr-xdebian/tests/t/dash-Dm.t20
-rwxr-xr-xdebian/tests/t/dash-U.t9
-rw-r--r--debian/tests/t/subsequential-combining-diacritical.txt1
-rw-r--r--debian/tests/t/unicode-output.t23
-rwxr-xr-xdebian/tests/t/version-help.t11
12 files changed, 162 insertions, 0 deletions
diff --git a/debian/tests/t/boilerplate.sh b/debian/tests/t/boilerplate.sh
new file mode 100644
index 0000000..f7c69d6
--- /dev/null
+++ b/debian/tests/t/boilerplate.sh
@@ -0,0 +1,51 @@
+# -*- sh -*-
+
+TESTNAME=`basename $0`.`mktemp -u XXXXXXXX`
+SCREEN="screen -S $TESTNAME"
+SCREENRC=/dev/null
+export SCREENRC
+count=0
+
+check_exit_code_true() {
+ if [ "$?" != 0 ]; then echo -n 'not '; fi; echo ok $(( count+=1 )) - "$@"
+}
+
+check_exit_code_false() {
+ if [ "$?" = 0 ]; then echo -n 'not '; fi; echo ok $(( count+=1 )) - "$@"
+}
+
+has_session_with_testname() {
+ screen -ls | fgrep -q "$TESTNAME"
+}
+
+session_exists_2_tests() {
+ screen -ls | fgrep -q '(Detached)'
+ check_exit_code_true Detached session found
+
+ has_session_with_testname
+ check_exit_code_true Session has expected session name
+}
+
+create_session_3_tests() {
+ $SCREEN -d -m "$@"
+ check_exit_code_true Create session
+
+ sleep 1
+
+ session_exists_2_tests
+}
+
+kill_session_2_tests() {
+ $SCREEN -X quit
+ check_exit_code_true Quit command sent to session
+
+ sleep 1
+
+ has_session_with_testname
+ check_exit_code_false Session is gone
+}
+
+has_window_number_zero() {
+ $SCREEN -Q windows | egrep -q '^0 '
+ check_exit_code_true Session has a window with id 0
+}
diff --git a/debian/tests/t/bug-600246.txt b/debian/tests/t/bug-600246.txt
new file mode 100644
index 0000000..c45c230
--- /dev/null
+++ b/debian/tests/t/bug-600246.txt
@@ -0,0 +1 @@
+が..
diff --git a/debian/tests/t/bug-677512.txt b/debian/tests/t/bug-677512.txt
new file mode 100644
index 0000000..1dd3ee8
--- /dev/null
+++ b/debian/tests/t/bug-677512.txt
@@ -0,0 +1 @@
+a̅e
diff --git a/debian/tests/t/bug-982435-CVE-2021-26937.crash b/debian/tests/t/bug-982435-CVE-2021-26937.crash
new file mode 100644
index 0000000..d9c5078
--- /dev/null
+++ b/debian/tests/t/bug-982435-CVE-2021-26937.crash
@@ -0,0 +1 @@
+円ᆆᆿ忿ᇎᆿ忘ᆿᆿ忿ᆾᆿ応ᆿᆿ忿ᆷᆿ忑ᆿᆿ忿ᇠᆿ冺ᆿᆿ忿ᇇᆿ忟ᆿᆿ忿ᆺᆿ忳ᆿᆿ忿ᅳᆿ忣ᆿᆿ忿ᇯᆿ忇ᆿᆿ忿ᇅᆿ忙ᆿᆿ忿ᆼᆿ忇ᆃᆿ忿ᅶᆿ忲ᆿᆿ忿ᇃᆿ忚ᆿᆿ忿ᆫᆿ忱ᆿᆿ忿ᆅᆿ念ᆿᆿ忿ᇐᆿ忺ᆿᆿ忿ᆆᆿ忡ᆿᆿ忿ᆀᆿ忀ᆿᆿ忿ᇳᆿ凿ᆿᆿ忿ᇨᆿ忄ᆿᆿ冁ᆿᆿ忿ᇛᆿ忿ᇁᆿ冿ᆿᆿ忷ᆿᆿ必ᆿᆿ忿ᇾᆿ徆ᆿᆿ忿ᇕᆿ念ᆆᆿ忿ᅿᆿ冿ᆆᆿ忿ᆃᆿ忬ᆿᆿ忿ᆔᆿ忩ᆿᆿ冥ᆿᆿ忿ᆰᆿ忿ᆮᆿ心ᆿᆿ忿ᅱᆿ忼ᆿᆿ忿ᆠᆿ忻ᆿᆿ忿ᆙᆿ忳ᆆᆿ忿ᆂᆿ忌ᆿᆿ忿ᇔᆿ忺ᆾᆿ忿ᇲᆿ忀ᆤᆿ忿ᆄᆿ徿ᆿᆿ忿ᆉᆿ忿ᆞᆿ忿ᆎᆿ忘ᆶᆿ冊ᆿᆿ志ᆿᆿ忿ᆯᆿ忆ᆿᆿ忿ᇤᆿ忬ᆠᆿ忆ᆃᆿ忄ᆻᆿ冸ᆿᆿ忯ᆿᆿ冽ᆿᆿ忏ᆿᆿ忿ᆇᆿ忿ᆬᆿ忿ᇱᆿ快ᆿᆿ忿ᇞᆿ忿ᆜᆿ忀ᆠᆿ忯ᆞᆿ忿ᆨᆿ忹ᆿᆿ忿ᆪᆿ冴ᆿᆿ忿ᆐᆿ忿ᇰᆿ忿ᅼᆿ忖ᆿᆿ忿ᇻᆿ心ᆩᆿ忿ᇧᆿ忠ᆿᆿ忿ᇈᆿ忔ᆿᆿ忺ᆐᆿ忝ᆿᆿ忿ᇺᆿ忴ᆿᆿ忿ᆕᆿ忿ᆵᆿ忿ᇶᆿ忎ᆿᆿ忿ᅾᆿ忷ᆆᆿ忿ᆖᆿ忛ᆿᆿ忿ᇉᆿ忞ᆿᆿ忿ᇷᆿ忭ᆿᆿ冤ᆿᆿ忿ᆍᆿ忿ᇭᆿ忿ᇖᆿ冰ᆿᆿ忢ᆿᆿ忱ᆾᆿ忦ᆿᆿ忿ᆒᆿ忸ᆿᆿ冿ᆯᆿ忿ᆏᆿ忌ᆯᆿ忪ᆿᆿ忿ᇿᆿ忇ᆙᆿ忸ᆔᆿ徿ᆆᆿ忿ᆘᆿ忩ᆅᆿ忿ᇄᆿ忿ᇏᆿ忿ᆭᆿ忌ᆸᆿ忿ᆛᆿ忹ᆆᆿ忿ᅲᆿ忄ᆺᆿ忿ᇩᆿ忬ᆦᆿ忸ᆉᆿ忁ᆿᆿ忿ᆱᆿ凿ᆆᆿ忿ᇦᆿ忿ᆢᆿ忇ᆾᆿ忰ᆿᆿ忿ᆣᆿ忺ᆆᆿ忷ᆭᆿ忺ᆉᆿ忿ᆶᆿ忠ᆱᆿ忿ᇼᆿ忘ᆼᆿ忎ᆉᆿ忚ᆛᆿ忥ᆿᆿ忤ᆿᆿ忣ᆉᆿ忡ᆁᆿ忇ᆼᆿ念ᆐᆿ忿ᆿᆿ徽ᆿᆿ冿ᆐᆿ忿ᇒᆿ忿ᆧᆿ忒ᆿᆿ忿ᇜᆿ忨ᆿᆿ忿ᆦᆿ忿ᇙᆿ忿ᆈᆿ忸ᆆᆿ忿ᆲᆿ忡ᆉᆿ忿ᇘᆿ忥ᆆᆿ忿ᇥᆿ忊ᆿᆿ心ᆼᆿ忠ᆐᆿ忿ᆳᆿ忄ᆠᆿ忿ᆁᆿ志ᆱᆿ忿ᇆᆿ忤ᆆᆿ忴ᆶᆿ忿ᆓᆿ忿ᆸᆿ忳ᆻᆿ忿ᇸᆿ忮ᆿᆿ忿ᆤᆿ忰ᆎᆿ忻ᆲᆿ忇ᆞᆿ忇ᆱᆿ忋ᆿᆿ忺ᆅᆿ忴ᆆᆿ忿ᆥᆿ忇ᆄᆿ忿ᆹᆿ忧ᆿᆿ応ᆠᆿ忿ᅻᆿ忿ᆩᆿ忰ᆇᆿ忲ᆄᆿ忕ᆿᆿ応ᆕᆿ忿ᇹᆿ忿ᆊᆿ忌ᆇᆿ忿ᇊᆿ忣ᆃᆿ忆ᆱᆿ忻ᆆᆿ忿ᆚᆿ忰ᆱᆿ忿ᆌᆿ忶ᆿᆿ忿ᆻᆿ忿ᆑᆿ忞ᆳᆿ忶ᆆᆿ冇ᆿᆿ忽ᆿᆿ忿ᆟᆿ志ᆼᆿ忿ᇮᆿ忨ᆇᆿ円ᆿᆿ忿ᅰᆿ忇ᆇᆿ忤ᆯ忿ᆿ
diff --git a/debian/tests/t/bug-982435-CVE-2021-26937.t b/debian/tests/t/bug-982435-CVE-2021-26937.t
new file mode 100644
index 0000000..90cc361
--- /dev/null
+++ b/debian/tests/t/bug-982435-CVE-2021-26937.t
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+echo 1..2
+
+. `dirname $0`/boilerplate.sh
+
+for enc in C C.UTF-8 ; do
+ LC_ALL=$enc
+ export LC_ALL
+
+ $SCREEN cat debian/tests/t/bug-982435-CVE-2021-26937.crash > /dev/null 2>&1
+ sleep 1
+ screen -ls | fgrep -q 'Dead ???'
+ check_exit_code_false "No dead session found after triggering a CVE-2021-26937 crash (LC_ALL=$enc)"
+
+ # Cleanup in case of crash
+ screen -wipe > /dev/null 2>&1 || true
+done
diff --git a/debian/tests/t/command.t b/debian/tests/t/command.t
new file mode 100755
index 0000000..c59bafb
--- /dev/null
+++ b/debian/tests/t/command.t
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+echo 1..4
+
+. `dirname $0`/boilerplate.sh
+
+$SCREEN -D -m -s /bin/true sleep 2 &
+check_exit_code_true Create session
+
+sleep 1
+
+session_exists_2_tests
+
+sleep 2
+
+has_session_with_testname
+check_exit_code_false Session is gone
diff --git a/debian/tests/t/create-list-quit.t b/debian/tests/t/create-list-quit.t
new file mode 100755
index 0000000..d792578
--- /dev/null
+++ b/debian/tests/t/create-list-quit.t
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+echo 1..6
+
+. `dirname $0`/boilerplate.sh
+
+create_session_3_tests
+has_window_number_zero
+kill_session_2_tests
diff --git a/debian/tests/t/dash-Dm.t b/debian/tests/t/dash-Dm.t
new file mode 100755
index 0000000..1f2b391
--- /dev/null
+++ b/debian/tests/t/dash-Dm.t
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+echo 1..5
+
+. `dirname $0`/boilerplate.sh
+
+$SCREEN -D -m &
+check_exit_code_true Create session
+
+sleep 1
+
+session_exists_2_tests
+
+$SCREEN -X quit
+check_exit_code_true Quit command sent to session
+
+sleep 1;
+
+has_session_with_testname
+check_exit_code_false Session is gone
diff --git a/debian/tests/t/dash-U.t b/debian/tests/t/dash-U.t
new file mode 100755
index 0000000..d8ef84c
--- /dev/null
+++ b/debian/tests/t/dash-U.t
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+echo 1..6
+
+. `dirname $0`/boilerplate.sh
+
+create_session_3_tests -U
+has_window_number_zero
+kill_session_2_tests
diff --git a/debian/tests/t/subsequential-combining-diacritical.txt b/debian/tests/t/subsequential-combining-diacritical.txt
new file mode 100644
index 0000000..f08f832
--- /dev/null
+++ b/debian/tests/t/subsequential-combining-diacritical.txt
@@ -0,0 +1 @@
+e̤̒
diff --git a/debian/tests/t/unicode-output.t b/debian/tests/t/unicode-output.t
new file mode 100644
index 0000000..e7d56e9
--- /dev/null
+++ b/debian/tests/t/unicode-output.t
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+echo 1..$(ls -1 $(dirname $0)/*.txt | wc -l)
+
+. `dirname $0`/boilerplate.sh
+
+LC_ALL=C.UTF-8
+export LC_ALL
+TERM=xterm
+export TERM
+
+for file in $(ls -1 $(dirname $0)/*.txt) ; do
+ echo === BEGIN $file ===
+ cat $file
+ echo === END $file ===
+ echo "=== BEGIN $file (escaped) ==="
+ cat -v $file
+ echo "=== END $file (escaped) ==="
+ script -c "$SCREEN cat $file" ${file}.output | cat -v
+ fgrep -F -f $file -q ${file}.output
+ check_exit_code_true Found contents of $file in ${file}.output
+ rm -f ${file}.output
+done
diff --git a/debian/tests/t/version-help.t b/debian/tests/t/version-help.t
new file mode 100755
index 0000000..f6496c0
--- /dev/null
+++ b/debian/tests/t/version-help.t
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+echo 1..2
+
+. `dirname $0`/boilerplate.sh
+
+screen -v | fgrep -q 'Screen version '
+check_exit_code_true Outputs version
+
+screen -h | fgrep -q 'Options:'
+check_exit_code_true Outputs help