[PATCH] Portability improvements for regress/cipher-speed.sh

Darren Tucker dtucker at zip.com.au
Tue Mar 12 10:40:09 EST 2013


On Tue, Mar 12, 2013 at 10:20:15AM +1100, Darren Tucker wrote:
> On Mon, Mar 11, 2013 at 11:33:35AM -0700, Iain Morgan wrote:
> > Hi,
> > 
> > Although cipher-speed.sh isn't failing, its output is useless on some
> > platforms. Aside from the definition of $DATA noted in a previous post
> > to this list, it makes assumptions about dd's status message and the
> > behaviour of echo.
> > 
> > The patch below addresses these issue, at least on RHEL.
> 
> The patch makes assumptions about the existence of /dev/zero :-)
> I'd rather have test-exec.sh create (and cleanup) $DATA in one place,
> maybe by concatenating sshd$(EXEEXT) a few times.
> 
> Also, why the echon->printf changes?

nevermind, I see the problem with \t parsing (or not).

How about this?  I'll remove DATA from the other tests later.

Index: regress/Makefile
===================================================================
RCS file: /var/cvs/openssh/regress/Makefile,v
retrieving revision 1.55
diff -u -p -r1.55 Makefile
--- regress/Makefile	20 Feb 2013 03:01:52 -0000	1.55
+++ regress/Makefile	11 Mar 2013 23:34:30 -0000
@@ -71,7 +71,7 @@ INTEROP_TESTS=	putty-transfer putty-ciph
 USER!=		id -un
 CLEANFILES=	t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
 		t8.out t8.out.pub t9.out t9.out.pub \
-		authorized_keys_${USER} known_hosts pidfile \
+		authorized_keys_${USER} known_hosts pidfile testdata \
 		ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \
 		rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
 		rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
Index: regress/cipher-speed.sh
===================================================================
RCS file: /var/cvs/openssh/regress/cipher-speed.sh,v
retrieving revision 1.10
diff -u -p -r1.10 cipher-speed.sh
--- regress/cipher-speed.sh	19 Feb 2013 19:53:30 -0000	1.10
+++ regress/cipher-speed.sh	11 Mar 2013 23:34:30 -0000
@@ -5,12 +5,11 @@ tid="cipher speed"
 
 getbytes ()
 {
-	sed -n '/transferred/s/.*secs (\(.* bytes.sec\).*/\1/p'
+	sed -n -e '/transferred/s/.*secs (\(.* bytes.sec\).*/\1/p' \
+	    -e '/copied/s/.*s, \(.* MB.s\).*/\1/p'
 }
 
 tries="1 2"
-DATA=/bin/ls
-DATA=/bsd
 
 ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc 
 	arcfour128 arcfour256 arcfour 
@@ -26,7 +25,7 @@ config_defined HAVE_EVP_SHA256 && \
 for c in $ciphers; do n=0; for m in $macs; do
 	trace "proto 2 cipher $c mac $m"
 	for x in $tries; do
-		echon "$c/$m:\t"
+		printf "%-60s" "$c/$m:"
 		( ${SSH} -o 'compression no' \
 			-F $OBJ/ssh_proxy -2 -m $m -c $c somehost \
 			exec sh -c \'"dd of=/dev/null obs=32k"\' \
@@ -47,7 +46,7 @@ ciphers="3des blowfish"
 for c in $ciphers; do
 	trace "proto 1 cipher $c"
 	for x in $tries; do
-		echon "$c:\t"
+		printf "%-60s" "$c:"
 		( ${SSH} -o 'compression no' \
 			-F $OBJ/ssh_proxy -1 -c $c somehost \
 			exec sh -c \'"dd of=/dev/null obs=32k"\' \
Index: regress/test-exec.sh
===================================================================
RCS file: /var/cvs/openssh/regress/test-exec.sh,v
retrieving revision 1.45
diff -u -p -r1.45 test-exec.sh
--- regress/test-exec.sh	2 Jul 2012 15:11:28 -0000	1.45
+++ regress/test-exec.sh	11 Mar 2013 23:34:30 -0000
@@ -140,6 +140,10 @@ if [ "x$TEST_SSH_LOGFILE" = "x" ]; then
 	TEST_SSH_LOGFILE=/dev/null
 fi
 
+# Some data for test copies
+DATA=$OBJ/testdata
+cat $SSHD${EXEEXT} $SSHD${EXEEXT} $SSHD${EXEEXT} $SSHD${EXEEXT} >$DATA
+
 # these should be used in tests
 export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
 #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list