From d745f085f45449153aca2cfdf73a749cea8b2cff Mon Sep 17 00:00:00 2001 From: dtucker Date: Thu, 23 Apr 2015 05:01:19 +0000 Subject: [PATCH] Add a simple regression test for sshd's configuration parser. Right now, all it does is run the output of sshd -T back through itself and ensure the output is valid and invariant. --- regress/usr.bin/ssh/Makefile | 3 ++- regress/usr.bin/ssh/cfgparse.sh | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 regress/usr.bin/ssh/cfgparse.sh diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile index 8cc2fcf7984..1c2b75c8b03 100644 --- a/regress/usr.bin/ssh/Makefile +++ b/regress/usr.bin/ssh/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.79 2015/03/16 22:46:14 djm Exp $ +# $OpenBSD: Makefile,v 1.80 2015/04/23 05:01:19 dtucker Exp $ .ifndef SKIP_UNIT SUBDIR= unittests @@ -50,6 +50,7 @@ LTESTS= connect \ multiplex \ reexec \ brokenkeys \ + cfgparse \ cfgmatch \ addrmatch \ localcommand \ diff --git a/regress/usr.bin/ssh/cfgparse.sh b/regress/usr.bin/ssh/cfgparse.sh new file mode 100644 index 00000000000..d86cb394cf1 --- /dev/null +++ b/regress/usr.bin/ssh/cfgparse.sh @@ -0,0 +1,16 @@ +# $OpenBSD: cfgparse.sh,v 1.1 2015/04/23 05:01:19 dtucker Exp $ +# Placed in the Public Domain. + +tid="config parse" + +verbose "reparse default config" +($SUDO ${SSHD} -T -f /dev/null >$OBJ/sshd_config.1 && + $SUDO ${SSHD} -T -f $OBJ/sshd_config.1 >$OBJ/sshd_config.2 && + diff $OBJ/sshd_config.1 $OBJ/sshd_config.2) || fail "reparse default config" + +verbose "reparse regress config" +($SUDO ${SSHD} -T -f $OBJ/sshd_config >$OBJ/sshd_config.1 && + $SUDO ${SSHD} -T -f $OBJ/sshd_config.1 >$OBJ/sshd_config.2 && + diff $OBJ/sshd_config.1 $OBJ/sshd_config.2) || fail "reparse regress config" + +rm -f $OBJ/sshd_config.[12] -- 2.20.1