jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh
author jjg
Thu, 22 May 2008 15:51:41 -0700
changeset 655 1ebc7ce89018
parent 2 90ce3da70b43
child 1009 5b7fdd22db38
permissions -rw-r--r--
6705945: com.sun.tools.javac.zip files do not have valid copyright Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/ksh -p
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
# Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
# have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#   @test       Solaris32AndSolaris64Test.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#   @bug        4478312 4780570 4913748
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#   @summary    Test debugging with mixed 32/64bit VMs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#   @author     Tim Bell
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#   Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#   @run build TestScaffold VMConnection TargetListener TargetAdapter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#   @run compile -g FetchLocals.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#   @run compile -g DataModelTest.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#   @run shell/timeout=240 Solaris32AndSolaris64Test.sh DataModelTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#   @run shell/timeout=240 Solaris32AndSolaris64Test.sh FetchLocals
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
# Beginning of subroutines:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
status=1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#Call this from anywhere to fail the test with an error message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
# usage: fail "reason why the test failed"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
fail() 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 { echo "The test failed :-("
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
   echo "$*" 1>&2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
   echo "exit status was $status"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
   exit $status
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 } #end of fail()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#Call this from anywhere to pass the test with a message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
# usage: pass "reason why the test passed if applicable"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
pass() 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 { echo "The test passed!!!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
   echo "$*" 1>&2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
   exit 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 } #end of pass()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
# end of subroutines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
if [ $# = 0 ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    echo "Error: no testname specified on cmd line"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
testName=$1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
shift
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
#Set appropriate jdk 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
if [ -z "${TESTJAVA}" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
   # TESTJAVA is not set, so the test is running stand-alone.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
   # TESTJAVA holds the path to the root directory of the build of the JDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
   # to be tested.  That is, any java files run explicitly in this shell
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
   # should use TESTJAVA in the path to the java interpreter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
   # So, we'll set this to the JDK spec'd on the command line.  If none
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
   # is given on the command line, tell the user that and use a default.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
   # THIS IS THE JDK BEING TESTED.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
   if [ -n "$1" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
          TESTJAVA=$1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
      else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
          echo "no JDK specified on command line so using JAVA_HOME=$JAVA_HOME"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
	  TESTJAVA=$JAVA_HOME
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
   fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
   TESTSRC=.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
   TESTCLASSES=.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
   STANDALONE=1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
echo "JDK under test is: $TESTJAVA"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
# The beginning of the script proper
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
# Checking for proper OS and processor type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
# This test is only interested in SunOS SPARC sparcv9 and SunOS AMD64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
# (supporting both 32 and 64 bit Solaris binaries).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
# All other platforms will instantly complete with passing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
# status.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
OS=`uname -s`
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
case "$OS" in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
   SunOS )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
      PATHSEP=":"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
      PTYPE=`uname -p`
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      if [ -x /usr/bin/isainfo ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
	  # Instruction set being used by the OS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
	  ISET=`isainfo -k`
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
      else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
	  #SunOS 5.6 didn't have "isainfo"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
          pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
      fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
   Linux )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
      pass "This test always passes on $OS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
   Windows* | CYGWIN*)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
      pass "This test always passes on $OS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
   # catch all other OSs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
   * )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
      echo "Unrecognized system!  $OS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
      fail "Unrecognized system!  $OS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
# Is the OS running in sparcv9 or amd64 mode?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
case "${ISET}" in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
  sparc )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
      pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
  i386 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
      pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
  amd64 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
      echo "OS is running in ${ISET} mode"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  sparcv9 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
      echo "OS is running in ${ISET} mode"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
  # catch all others
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
  * )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
      echo "Unrecognized instruction set!  $OS/$PTYPE/${ISET}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
      fail "Unrecognized instruction set!  $OS/$PTYPE/${ISET}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
# SunOS 32 and 64 bit binaries must be available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
#     to test in the remainder of the script below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
$TESTJAVA/bin/java -d64 -version > /dev/null 2<&1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
if [ $? = 1 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
   # The 64 bit version is not installed.  Make the test pass.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
   pass "This test always passes on $OS/$PTYPE if 64 bit jdk is not installed"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
# Want this test to run standalone as well as in the harness, so do the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
#  following to copy the test's directory into the harness's scratch directory 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
#  and set all appropriate variables:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
#Deal with .class files:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
if [ -n "${STANDALONE}" ] ; then 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
   #if running standalone, compile the support files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
   ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
   ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." -g \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            FetchLocals.java DataModelTest.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
# Get DEBUGGEE flags
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
DEBUGGEEFLAGS=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
filename=$TESTCLASSES/@debuggeeVMOptions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
if [ ! -r ${filename} ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    filename=$TESTCLASSES/../@debuggeeVMOptions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
if [ -r ${filename} ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    DEBUGGEEFLAGS=`cat ${filename} | sed -e 's/-d32//g' -e 's/-d64//g'`
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
CLASSPATH="$TESTJAVA/lib/tools.jar${PATHSEP}${TESTCLASSES}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
export CLASSPATH
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
CP="-classpath \"${CLASSPATH}\""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
for DEBUGGERMODEL in \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    32 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    64 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    for TARGETMODEL in \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        32 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        64 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        DEBUGGERFLAGS="-d${DEBUGGERMODEL} -showversion -DEXPECTED=${TARGETMODEL}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        CONNECTSTRING="-connect 'com.sun.jdi.CommandLineLaunch:options=-d${TARGETMODEL} $DEBUGGEEFLAGS -showversion'"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
	for TARGETCLASS in $testName ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
	    echo "--------------------------------------------"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
	    echo "debugger=${DEBUGGERMODEL} debugee=${TARGETMODEL} class=${TARGETCLASS}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
	    echo "--------------------------------------------"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
	    echo ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
	    eval ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
	    status=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
	    if [ $status -ne "0" ];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
	       then fail "$DEBUGGERMODEL to $TARGETMODEL test failed for class=$TARGETCLASS!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
	    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
	done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
done  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
# pass or fail the test based on status of the command
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
if [ $status -eq "0" ];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
   then pass ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
   else fail "unspecified test failure"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
fi