Add a simple regression test for sshd's configuration parser. Right now,
authordtucker <dtucker@openbsd.org>
Thu, 23 Apr 2015 05:01:19 +0000 (05:01 +0000)
committerdtucker <dtucker@openbsd.org>
Thu, 23 Apr 2015 05:01:19 +0000 (05:01 +0000)
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
regress/usr.bin/ssh/cfgparse.sh [new file with mode: 0644]

index 8cc2fcf..1c2b75c 100644 (file)
@@ -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 (file)
index 0000000..d86cb39
--- /dev/null
@@ -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]