Actually skip pty tests when needed.

This commit is contained in:
Darren Tucker 2020-05-13 15:24:51 +10:00
parent 08ce6b2210
commit f700d316c6
1 changed files with 8 additions and 2 deletions

View File

@ -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`