1 #! /usr/bin/ksh -p
   2 #
   3 # CDDL HEADER START
   4 #
   5 # The contents of this file are subject to the terms of the
   6 # Common Development and Distribution License (the "License").
   7 # You may not use this file except in compliance with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 
  28 . ${STF_SUITE}/include/nfsgen.kshlib
  29 
  30 readonly FILE=$(whence -p ${0})
  31 readonly NAME=$(basename $0)
  32 readonly DIR=$(dirname $0)
  33 
  34 [[ :$NFSGEN_DEBUG: = *:${NAME}:* \
  35         || :${NFSGEN_DEBUG}: = *:all:* ]] && set -x
  36 
  37 
  38 if [[ $SHRDIR == "/" ]]; then
  39         echo "As SHRDIR is set '/', the case can't run 'find' in MNTDIR"
  40         exit $STF_UNTESTED
  41 fi
  42 
  43 # ----------------------------------------------------------------------
  44 echo "\n $NAME: multiple <find>s in ${SERVER}:$SHRDIR mounting <${MNTDIR}>"
  45 echo "\t START TIME: `date`\n"
  46 
  47 #
  48 # Default of 5 child processes if ST04_KIDS is not set
  49 #
  50 ST04_KIDS=${ST04_KIDS:-5}
  51 echo "\t ==> Going to start ${ST04_KIDS} processes"
  52 typeset i=0
  53 while (( $i < ${ST04_KIDS} )); do
  54         (
  55                 [[ :$NFSGEN_DEBUG: = *:${NAME}:* \
  56                         || :${NFSGEN_DEBUG}: = *:all:* ]] && set -x
  57 
  58                 cd ${MNTDIR} > $STF_TMPDIR/cd.$i.$$
  59                 if (( $? != 0 )); then
  60                         cat $STF_TMPDIR/cd.$i.$$
  61                         echo "KID=$i: chdir into ${MNT} failed."
  62                         cleanup $STF_UNINITIATED
  63                 fi
  64     
  65                 find . -ls > $STF_TMPDIR/find.$i.$$ 2>&1
  66                 if (( $? != 0 )); then
  67                         echo " KID=$i, find failed"
  68                         cat $STF_TMPDIR/find.$i.$$
  69                         cleanup $STF_FAIL
  70                 fi
  71         )&
  72         (( i = i+1 ))
  73 done
  74 
  75 # Now wait for all processes to complete
  76 wait
  77 
  78 echo "\t Test PASS: Test run completed successfully"
  79 echo "\t END TIME: `date`\n"
  80 cleanup $STF_PASS