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

Iain Morgan imorgan at nas.nasa.gov
Tue Mar 12 05:33:35 EST 2013


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.

Index: regress/cipher-speed.sh
===================================================================
RCS file: /cvs/openssh/regress/cipher-speed.sh,v
retrieving revision 1.10
diff -u -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 18:19:14 -0000
@@ -5,12 +5,13 @@
 
 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
+DATA=/tmp/cipher-speed.$$
+dd if=/dev/zero of=$DATA bs=4k count=1024 2> /dev/null
 
 ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc 
 	arcfour128 arcfour256 arcfour 
@@ -26,7 +27,7 @@
 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 +48,7 @@
 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"\' \
@@ -57,3 +58,5 @@
 		fi
 	done
 done
+
+rm $DATA

-- 
Iain Morgan


More information about the openssh-unix-dev mailing list