summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2020-05-13 15:24:51 +1000
committerDarren Tucker <dtucker@dtucker.net>2020-05-13 15:24:51 +1000
commitf700d316c6b15a9cfbe87230d2dca81a5d916279 (patch)
treef54fabab63b53cbd75afef1759b2650cde6f8754
parent08ce6b2210f46f795e7db747809f8e587429dfd2 (diff)
Actually skip pty tests when needed.
-rw-r--r--regress/key-options.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/regress/key-options.sh b/regress/key-options.sh
index 112c9bd8..097f46eb 100644
--- a/regress/key-options.sh
+++ b/regress/key-options.sh
@@ -7,6 +7,12 @@ origkeys="$OBJ/authkeys_orig"
authkeys="$OBJ/authorized_keys_${USER}"
cp $authkeys $origkeys
+# Allocating ptys can require privileges on some platforms.
+skip_pty=""
+if ! config_defined HAVE_OPENPTY && [ "x$SUDO" == "x" ]; then
+ skip_pty="no openpty(3) and SUDO not set"
+fi
+
# Test command= forced command
for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do
sed "s/.*/$c &/" $origkeys >$authkeys
@@ -27,7 +33,7 @@ expect_pty_succeed() {
rm -f $OBJ/data
sed "s/.*/$opts &/" $origkeys >$authkeys
verbose "key option pty $which"
- config_defined HAVE_OPENPTY || verbose "skipped for no openpty(3)"
+ [ "x$skip_pty" != "x" ] && verbose "skipped because $skip_pty" && return
${SSH} -ttq -F $OBJ/ssh_proxy somehost "tty > $OBJ/data; exit 0"
if [ $? -ne 0 ] ; then
fail "key option failed $which"
@@ -45,7 +51,7 @@ expect_pty_fail() {
rm -f $OBJ/data
sed "s/.*/$opts &/" $origkeys >$authkeys
verbose "key option pty $which"
- config_defined HAVE_OPENPTY || verbose "skipped for no openpty(3)"
+ [ "x$skip_pty" != "x" ] && verbose "skipped because $skip_pty" && return
${SSH} -ttq -F $OBJ/ssh_proxy somehost "tty > $OBJ/data; exit 0"
if [ $? -eq 0 ]; then
r=`cat $OBJ/data`