3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is the Netscape security libraries.
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1994-2000
21 # the Initial Developer. All Rights Reserved.
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
39 ########################################################################
41 # mozilla/security/nss/tests/ssl/ssl_dist_stress.sh
43 # Script to test NSS SSL - distributed stresstest - this script needs to
44 # source the regular ssl.sh (for shellfunctions, certs and variables
48 # start itself via rsh on different systems to connect back to the server
51 # needs to work on all Unix and Windows platforms
55 # FIXME ... known problems, search for this string
56 # NOTE .... unexpected behavior
58 ########################################################################
60 ############################## ssl_ds_init #############################
61 # local shell function to initialize this script
62 ########################################################################
65 if [ -z "$GLOB_MIN_CERT" ] ; then
68 if [ -z "$GLOB_MAX_CERT" ] ; then
78 SCRIPTNAME
=ssl_dist_stress.sh
# sourced - $0 would point to all.sh
80 if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for
81 CLEANUP
="${SCRIPTNAME}" # cleaning this script will do it
84 ssl_init
# let some other script do the hard work (initialize, generate certs, ...
86 SCRIPTNAME
=ssl_dist_stress.sh
87 echo "$SCRIPTNAME: SSL distributed stress tests ==============================="
91 ######################### ssl_ds_usage #################################
92 # local shell function to explain the usage
93 ########################################################################
96 echo "Usage: `basename $1`"
97 echo " -host hostname "
98 echo " ...host who runs the server, for distributed stress test"
100 echo " ...runs the server sider of the distributed stress test"
101 echo " -dir unixdirectory "
102 echo " ...lets the server side of the distributed stress test"
103 echo " know where to find the scritp to start on the remote side"
104 echo " -certnum start-end"
105 echo " ... provides the range of certs for distributed stress test"
106 echo " for example -certnum 10-20 will connect 10 times"
107 echo " no blanks in the range string (not 10 - 20)"
108 echo " valid range ${GLOB_MIN_CERT}-${GLOB_MAX_CERT}"
109 echo " -? ...prints this text"
110 exit 1 #does not need to be Exit, very early in script
113 ######################### ssl_ds_eval_opts #############################
114 # local shell function to deal with options and parameters
115 ########################################################################
118 #use $0 not $SCRIPTNAM<E, too early, SCRIPTNAME not yet set
130 if [ -z $SERVERHOST ] ; then
131 echo "$0 `uname -n`: -host requires hostname"
134 echo "$0 `uname -n`: host $HOST ($1)"
138 rangeOK
=`echo $1 | sed -e 's/[0-9][0-9]*-[0-9][0-9]*/OK/'`
139 MIN_CERT
=`echo $1 | sed -e 's/-[0-9][0-9]*//' -e 's/^00*//'`
140 MAX_CERT
=`echo $1 | sed -e 's/[0-9][0-9]*-//' -e 's/^00*//'`
141 if [ -z "$rangeOK" -o "$rangeOK" != "OK" -o \
142 -z "$MIN_CERT" -o -z "$MAX_CERT" -o \
143 "$MIN_CERT" -gt "$MAX_CERT" -o \
144 "$MIN_CERT" -lt "$GLOB_MIN_CERT" -o \
145 "$MAX_CERT" -gt "$GLOB_MAX_CERT" ] ; then
146 echo "$0 `uname -n`: -certn range not valid"
149 echo "$0 `uname -n`: will use certs from $MIN_CERT to $MAX_CERT"
151 -server|
-stress|
-dist*st
*)
156 -dir|
-unixdir|
-uxdir|
-qadir)
159 #FIXME - we need a default unixdir
160 if [ -z "$UX_DIR" ] ; then # -o ! -d "$UX_DIR" ] ; then can't do, Win doesn't know...
161 echo "$0 `uname -n`: -dir requires directoryname "
164 CD_QADIR_SSL
="cd $UX_DIR"
169 if [ -z "$IP_ADDRESS" ] ; then
170 echo "$0 `uname -n`: -ip requires ip-address "
174 IP_PARAM
="-ip $IP_ADDRESS"
184 ############################## ssl_ds_rem_stress #######################
185 # local shell function to perform the client part of the SSL stress test
186 ########################################################################
190 testname
="SSL remote part of Stress test (`uname -n`)"
191 echo "$SCRIPTNAME `uname -n`: $testname"
193 #cp -r "${CLIENTDIR}" /tmp/ssl_ds.$$ #FIXME
200 while [ $CONTINUE -ge $MIN_CERT ]
202 echo "strsclnt -D -p ${PORT} -d ${P_R_CLIENTDIR} -w nss -c 1 $verbose "
203 echo " -n TestUser$CONTINUE ${HOSTADDR} #`uname -n`"
204 strsclnt
-D -p ${PORT} -d .
-w nss
-c 1 $verbose \
205 -n "TestUser$CONTINUE" ${HOSTADDR} &
207 CONTINUE
=`expr $CONTINUE - 1 `
208 #sleep 4 #give process time to start up
211 html_msg
0 0 "${testname}" #FIXME
214 ######################### ssl_ds_dist_stress ###########################
215 # local shell function to perform the server part of the new, distributed
217 ########################################################################
247 #clientlist=" huey-2 dewey-2 hornet-2 shabadoo-2" #FIXME ADJUST
248 clientlist
=" box-200 washer-200 huey-200 dewey-200 hornet-200 shabadoo-200 louie-200"
249 #clientlist=" box-2 huey-2 "
250 #clientlist="washer-200 huey-200 dewey-200 hornet-200 "
252 html_head
"SSL Distributed Stress Test"
254 testname
="SSL distributed Stress test"
256 echo cd "${CLIENTDIR}"
258 if [ -z "CD_QADIR_SSL" ] ; then
259 CD_QADIR_SSL
="cd $QADIR/ssl"
261 cp -r $HOSTDIR $HOSTDIR/..
/..
/..
/..
/..
/booboo_Solaris
8/mozilla
/tests_results
/security
264 #sparam=" -t 128 -D -r "
265 sparam
=" -t 16 -D -r -r -y "
270 client
=`echo $c | sed -e "s/-.*//"`
271 number
=`echo $c | sed -e "s/.*-//"`
274 ping $client >/dev
/null || CLIENT_OK
="FALSE"
275 if [ "$CLIENT_OK" = "FALSE" ] ; then
276 echo "$SCRIPTNAME `uname -n`: $client can't be reached - skipping"
278 get_certrange
$number
279 echo "$SCRIPTNAME `uname -n`: $RSH $client -l svbld \\ "
280 echo " \" $CD_QADIR_SSL ;ssl_dist_stress.sh \\"
281 echo " -host $HOST -certnum $CERTRANGE $IP_PARAM \" "
282 $RSH $client -l svbld \
283 " $CD_QADIR_SSL;ssl_dist_stress.sh -host $HOST -certnum $CERTRANGE $IP_PARAM " &
287 echo cd "${CLIENTDIR}"
290 sleep 500 # give the clients time to finish #FIXME ADJUST
292 echo "GET /stop HTTP/1.0\n\n" > stdin.txt
#check to make sure it has /r/n
293 echo "tstclnt -h $HOSTADDR -p 8443 -d ${P_R_CLIENTDIR} -n TestUser0 "
294 echo " -w nss -f < stdin.txt"
295 tstclnt
-h $HOSTADDR -p 8443 -d ${P_R_CLIENTDIR} -n TestUser0 \
296 -w nss
-f < stdin.txt
298 html_msg
0 0 "${testname}"
302 ############################ get_certrange #############################
303 # local shell function to find the range of certs that the next remote
304 # client is supposed to use (only for server side of the dist stress test
305 ########################################################################
308 rangeOK
=`echo $1 | sed -e 's/[0-9][0-9]*/OK/'`
309 if [ -z "$rangeOK" -o "$rangeOK" != "OK" -o $1 = "OK" ] ; then
311 echo "$SCRIPTNAME `uname -n`: $1 is not a valid number of certs "
312 echo " defaulting to 10 for $client"
315 if [ $range -gt $GLOB_MAX_CERT ] ; then
319 if [ -z "$FROM_CERT" ] ; then # start new on top of the cert stack
320 FROM_CERT
=$GLOB_MAX_CERT
321 elif [ `expr $FROM_CERT - $range + 1 ` -lt 0 ] ; then
322 FROM_CERT
=$GLOB_MAX_CERT # dont let it fall below 0 on the TO_CERT
325 TO_CERT
=`expr $FROM_CERT - $range + 1 `
326 if [ $TO_CERT -lt 0 ] ; then # it's not that I'm bad in math, I just
327 TO_CERT
=0 # don't trust expr...
329 CERTRANGE
="${TO_CERT}-${FROM_CERT}"
330 FROM_CERT
=`expr ${TO_CERT} - 1 ` #start the next client one below
334 ################## main #################################################
339 if [ -n "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then
341 exit 0 #no cleanup on purpose
342 elif [ -n "$DO_DIST_ST" -a "$DO_DIST_ST" = "TRUE" ] ; then