test/com/sun/jdi/ShellScaffold.sh

Print this page
rev 8975 : 8028537: PPC64: Updated the JDK regression tests to run on AIX
Reviewed-by: alanb
Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, volker.simonis@gmail.com


 182             fi
 183         else
 184             # Well, too bad - we can't find what to kill.  
 185             toBeKilled=
 186         fi
 187     fi
 188 
 189     if [ ! -z "$toBeKilled" ] ; then
 190         echo "$1: kill -9 $toBeKilled"  >& 2
 191         kill -9 $toBeKilled
 192     fi
 193 }    
 194 
 195 findPid()
 196 {
 197     # Return 0 if $1 is the pid of a running process.
 198     if [ -z "$isWin98" ] ; then
 199         if [ "$osname" = SunOS ] ; then
 200             # Solaris and OpenSolaris use pgrep and not ps in psCmd
 201             findPidCmd="$psCmd"


 202         else
 203             #   Never use plain 'ps', which requires a "controlling terminal"
 204             #     and will fail  with a "ps: no controlling terminal" error.
 205             #     Running under 'rsh' will cause this ps error.
 206             # cygwin ps puts an I in column 1 for some reason.
 207             findPidCmd="$psCmd -e"
 208         fi
 209         $findPidCmd | $grep '^I* *'"$1 " > $devnull 2>&1
 210         return $?
 211     fi
 212 
 213     # mks 6.2a on win98 has $! getting a negative
 214     # number and in ps, it shows up as 0x...
 215     # Thus, we can't search in ps output for 
 216     # PIDs gotten via $!
 217     # We don't know if it is running or not - assume it is.
 218     # We don't really care about win98 anymore.
 219     return 0
 220 }
 221 


 276          # treat them as control chars on mks (eg \t is tab)
 277          # Oops; windows mks really seems to want this cat line
 278          # to start in column 1
 279          if [ -w "$SystemRoot" ] ; then
 280             tmpFile=$SystemRoot/tmp.$$
 281          elif [ -w "$SYSTEMROOT" ] ; then
 282             tmpFile=$SYSTEMROOT/tmp.$$
 283          else
 284             tmpFile=tmp.$$
 285          fi
 286 cat <<EOF >$tmpFile
 287 $TESTCLASSES
 288 EOF
 289          TESTCLASSES=`cat $tmpFile | sed -e 's@\\\\@/@g'`
 290          rm -f $tmpFile
 291          # on mks
 292          grep=egrep
 293          psCmd=ps
 294          jstack=jstack.exe
 295          ;;
 296        SunOS | Linux | Darwin)
 297          transport=dt_socket
 298          address=
 299          devnull=/dev/null
 300          grep=egrep
 301          jstack=jstack
 302          # On linux, core files take a long time, and can leave
 303          # zombie processes
 304          if [ "$osname" = SunOS ] ; then
 305              # Experiments show Solaris '/usr/ucb/ps -axwww' and
 306              # '/usr/bin/pgrep -f -l' provide the same small amount of the
 307              # argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
 308              #  1) This seems to have been working OK in ShellScaffold.
 309              #  2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
 310              #     instead
 311              # The alternative would be to use /usr/bin/pargs [pid] to get
 312              # all the args for a process, splice them back into one
 313              # long string, then grep.
 314              UU=`/usr/xpg4/bin/id -u -n`
 315              psCmd="pgrep -f -l -U $UU"
 316          else




 182             fi
 183         else
 184             # Well, too bad - we can't find what to kill.  
 185             toBeKilled=
 186         fi
 187     fi
 188 
 189     if [ ! -z "$toBeKilled" ] ; then
 190         echo "$1: kill -9 $toBeKilled"  >& 2
 191         kill -9 $toBeKilled
 192     fi
 193 }    
 194 
 195 findPid()
 196 {
 197     # Return 0 if $1 is the pid of a running process.
 198     if [ -z "$isWin98" ] ; then
 199         if [ "$osname" = SunOS ] ; then
 200             # Solaris and OpenSolaris use pgrep and not ps in psCmd
 201             findPidCmd="$psCmd"
 202         elif [ "$osname" = AIX ] ; then
 203             findPidCmd="$psCmd"
 204         else
 205             #   Never use plain 'ps', which requires a "controlling terminal"
 206             #     and will fail  with a "ps: no controlling terminal" error.
 207             #     Running under 'rsh' will cause this ps error.
 208             # cygwin ps puts an I in column 1 for some reason.
 209             findPidCmd="$psCmd -e"
 210         fi
 211         $findPidCmd | $grep '^I* *'"$1 " > $devnull 2>&1
 212         return $?
 213     fi
 214 
 215     # mks 6.2a on win98 has $! getting a negative
 216     # number and in ps, it shows up as 0x...
 217     # Thus, we can't search in ps output for 
 218     # PIDs gotten via $!
 219     # We don't know if it is running or not - assume it is.
 220     # We don't really care about win98 anymore.
 221     return 0
 222 }
 223 


 278          # treat them as control chars on mks (eg \t is tab)
 279          # Oops; windows mks really seems to want this cat line
 280          # to start in column 1
 281          if [ -w "$SystemRoot" ] ; then
 282             tmpFile=$SystemRoot/tmp.$$
 283          elif [ -w "$SYSTEMROOT" ] ; then
 284             tmpFile=$SYSTEMROOT/tmp.$$
 285          else
 286             tmpFile=tmp.$$
 287          fi
 288 cat <<EOF >$tmpFile
 289 $TESTCLASSES
 290 EOF
 291          TESTCLASSES=`cat $tmpFile | sed -e 's@\\\\@/@g'`
 292          rm -f $tmpFile
 293          # on mks
 294          grep=egrep
 295          psCmd=ps
 296          jstack=jstack.exe
 297          ;;
 298        SunOS | Linux | Darwin | AIX)
 299          transport=dt_socket
 300          address=
 301          devnull=/dev/null
 302          grep=egrep
 303          jstack=jstack
 304          # On linux, core files take a long time, and can leave
 305          # zombie processes
 306          if [ "$osname" = SunOS ] ; then
 307              # Experiments show Solaris '/usr/ucb/ps -axwww' and
 308              # '/usr/bin/pgrep -f -l' provide the same small amount of the
 309              # argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
 310              #  1) This seems to have been working OK in ShellScaffold.
 311              #  2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
 312              #     instead
 313              # The alternative would be to use /usr/bin/pargs [pid] to get
 314              # all the args for a process, splice them back into one
 315              # long string, then grep.
 316              UU=`/usr/xpg4/bin/id -u -n`
 317              psCmd="pgrep -f -l -U $UU"
 318          else