From 4233cbeb78d9a6c0dac5fe5f46822390499a8b1b Mon Sep 17 00:00:00 2001 From: dtucker Date: Wed, 1 Sep 2021 00:50:27 +0000 Subject: [PATCH] Add a function to skip remaining tests. Many tests skip tests for various reasons but not in a consistent way and don't always clean up, so add that and switch the tests that do that over. --- regress/usr.bin/ssh/agent-getpeereid.sh | 6 ++---- regress/usr.bin/ssh/keys-command.sh | 4 ++-- regress/usr.bin/ssh/putty-ciphers.sh | 4 ++-- regress/usr.bin/ssh/putty-kex.sh | 4 ++-- regress/usr.bin/ssh/putty-transfer.sh | 4 ++-- regress/usr.bin/ssh/sftp-chroot.sh | 6 ++---- regress/usr.bin/ssh/sshfp-connect.sh | 6 +++--- regress/usr.bin/ssh/test-exec.sh | 10 +++++++++- 8 files changed, 24 insertions(+), 20 deletions(-) diff --git a/regress/usr.bin/ssh/agent-getpeereid.sh b/regress/usr.bin/ssh/agent-getpeereid.sh index 4afe7f5277b..372afee7a1a 100644 --- a/regress/usr.bin/ssh/agent-getpeereid.sh +++ b/regress/usr.bin/ssh/agent-getpeereid.sh @@ -1,4 +1,4 @@ -# $OpenBSD: agent-getpeereid.sh,v 1.12 2021/07/29 15:34:09 anton Exp $ +# $OpenBSD: agent-getpeereid.sh,v 1.13 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="disallow agent attach from other uid" @@ -17,9 +17,7 @@ case "x$SUDO" in elif [ -f /etc/doas.conf ]; then SUDO=/usr/bin/doas else - echo neither sudo and sudoers nor doas.conf exist - echo SKIPPED - exit 0 + skip "neither sudo and sudoers nor doas.conf exist" fi ;; *) fatal 'unsupported $SUDO - "doas" and "sudo" are allowed' ;; esac diff --git a/regress/usr.bin/ssh/keys-command.sh b/regress/usr.bin/ssh/keys-command.sh index 2ee0149b582..563dcb97d9a 100644 --- a/regress/usr.bin/ssh/keys-command.sh +++ b/regress/usr.bin/ssh/keys-command.sh @@ -1,4 +1,4 @@ -# $OpenBSD: keys-command.sh,v 1.6 2019/07/25 08:48:11 dtucker Exp $ +# $OpenBSD: keys-command.sh,v 1.7 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="authorized keys from command" @@ -69,5 +69,5 @@ if [ -x $KEY_COMMAND ]; then fail "connect failed" fi else - echo "SKIPPED: $KEY_COMMAND not executable (/var/run mounted noexec?)" + skip "$KEY_COMMAND not executable (/var/run mounted noexec?)" fi diff --git a/regress/usr.bin/ssh/putty-ciphers.sh b/regress/usr.bin/ssh/putty-ciphers.sh index 752aaf90436..f2819ab8c49 100644 --- a/regress/usr.bin/ssh/putty-ciphers.sh +++ b/regress/usr.bin/ssh/putty-ciphers.sh @@ -1,10 +1,10 @@ -# $OpenBSD: putty-ciphers.sh,v 1.9 2021/08/31 07:13:59 dtucker Exp $ +# $OpenBSD: putty-ciphers.sh,v 1.10 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="putty ciphers" if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then - fatal "putty interop tests not enabled" + skip "putty interop tests not enabled" fi # Re-enable ssh-rsa on older PuTTY versions. diff --git a/regress/usr.bin/ssh/putty-kex.sh b/regress/usr.bin/ssh/putty-kex.sh index eb78c0a49a1..c4268524feb 100644 --- a/regress/usr.bin/ssh/putty-kex.sh +++ b/regress/usr.bin/ssh/putty-kex.sh @@ -1,10 +1,10 @@ -# $OpenBSD: putty-kex.sh,v 1.7 2021/08/31 07:13:59 dtucker Exp $ +# $OpenBSD: putty-kex.sh,v 1.8 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="putty KEX" if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then - fatal "putty interop tests not enabled" + skip "putty interop tests not enabled" fi # Re-enable ssh-rsa on older PuTTY versions. diff --git a/regress/usr.bin/ssh/putty-transfer.sh b/regress/usr.bin/ssh/putty-transfer.sh index da6f1e3407d..aaf5a9e444f 100644 --- a/regress/usr.bin/ssh/putty-transfer.sh +++ b/regress/usr.bin/ssh/putty-transfer.sh @@ -1,10 +1,10 @@ -# $OpenBSD: putty-transfer.sh,v 1.9 2021/08/31 07:13:59 dtucker Exp $ +# $OpenBSD: putty-transfer.sh,v 1.10 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="putty transfer data" if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then - fatal "putty interop tests not enabled" + skip "putty interop tests not enabled" fi # Re-enable ssh-rsa on older PuTTY versions. diff --git a/regress/usr.bin/ssh/sftp-chroot.sh b/regress/usr.bin/ssh/sftp-chroot.sh index e399d5f1b1a..f9a7743eaa9 100644 --- a/regress/usr.bin/ssh/sftp-chroot.sh +++ b/regress/usr.bin/ssh/sftp-chroot.sh @@ -1,4 +1,4 @@ -# $OpenBSD: sftp-chroot.sh,v 1.7 2018/11/22 08:48:32 dtucker Exp $ +# $OpenBSD: sftp-chroot.sh,v 1.8 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="sftp in chroot" @@ -9,9 +9,7 @@ PRIVDATA=${CHROOT}/${FILENAME} trap "${SUDO} rm -f ${PRIVDATA}" 0 if [ -z "$SUDO" -a ! -w /var/run ]; then - echo "need SUDO to create file in /var/run, test won't work without" - echo SKIPPED - exit 0 + skip "need SUDO to create file in /var/run, test won't work without" fi $SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \ diff --git a/regress/usr.bin/ssh/sshfp-connect.sh b/regress/usr.bin/ssh/sshfp-connect.sh index a6b6fab5350..f78646922ef 100644 --- a/regress/usr.bin/ssh/sshfp-connect.sh +++ b/regress/usr.bin/ssh/sshfp-connect.sh @@ -1,4 +1,4 @@ -# $OpenBSD: sshfp-connect.sh,v 1.3 2021/08/31 01:25:27 dtucker Exp $ +# $OpenBSD: sshfp-connect.sh,v 1.4 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. # This test requires external setup and thus is skipped unless @@ -25,9 +25,9 @@ tid="sshfp connect" if ! $SSH -Q key-plain | grep ssh-rsa >/dev/null; then - echo SKIPPED: RSA keys not supported. + skip "RSA keys not supported." elif [ -z "${TEST_SSH_SSHFP_DOMAIN}" ]; then - echo SKIPPED: TEST_SSH_SSHFP_DOMAIN not set. + skip "TEST_SSH_SSHFP_DOMAIN not set." else # Set RSA host key to match fingerprints above. mv $OBJ/sshd_proxy $OBJ/sshd_proxy.orig diff --git a/regress/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh index 34efff60b8c..bf298fb51ec 100644 --- a/regress/usr.bin/ssh/test-exec.sh +++ b/regress/usr.bin/ssh/test-exec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: test-exec.sh,v 1.86 2021/08/08 08:27:28 dtucker Exp $ +# $OpenBSD: test-exec.sh,v 1.87 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. #SUDO=sudo @@ -280,6 +280,14 @@ fatal () exit $RESULT } +# Skip remaining tests in script. +skip () +{ + echo "SKIPPED: $@" + cleanup + exit $RESULT +} + RESULT=0 PIDFILE=$OBJ/pidfile -- 2.20.1