1 # 
   2 #  Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   3 #  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 # 
   5 #  This code is free software; you can redistribute it and/or modify it
   6 #  under the terms of the GNU General Public License version 2 only, as
   7 #  published by the Free Software Foundation.
   8 # 
   9 #  This code is distributed in the hope that it will be useful, but WITHOUT
  10 #  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 #  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 #  version 2 for more details (a copy is included in the LICENSE file that
  13 #  accompanied this code).
  14 # 
  15 #  You should have received a copy of the GNU General Public License version
  16 #  2 along with this work; if not, write to the Free Software Foundation,
  17 #  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 # 
  19 #  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 #  or visit www.oracle.com if you need additional information or have any
  21 #  questions.
  22 # 
  23 
  24  
  25 # @test Test6294277.sh
  26 # @bug 6294277
  27 # @summary java -Xdebug crashes on SourceDebugExtension attribute larger than 64K
  28 # @run shell Test6294277.sh
  29 #
  30 
  31 
  32 if [ "${TESTSRC}" = "" ]
  33 then TESTSRC=.
  34 fi
  35 
  36 if [ "${TESTJAVA}" = "" ]
  37 then
  38   PARENT=`dirname \`which java\``
  39   TESTJAVA=`dirname ${PARENT}`
  40   echo "TESTJAVA not set, selecting " ${TESTJAVA}
  41   echo "If this is incorrect, try setting the variable manually."
  42 fi
  43 
  44 BIT_FLAG=""
  45 
  46 # set platform-dependent variables
  47 OS=`uname -s`
  48 case "$OS" in
  49   SunOS | Linux )
  50     NULL=/dev/null
  51     PS=":"
  52     FS="/"
  53     ## for solaris, linux it's HOME
  54     FILE_LOCATION=$HOME
  55     if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" -a `uname -p`='sparc' ]
  56     then
  57         BIT_FLAG="-d64"
  58     fi
  59     ;;
  60   Windows_* )
  61     NULL=NUL
  62     PS=";"
  63     FS="\\"
  64     echo "Test skipped"
  65     exit 0
  66     ;;
  67   * )
  68     echo "Unrecognized system!"
  69     exit 1;
  70     ;;
  71 esac
  72 
  73 cp ${TESTSRC}${FS}*.java .
  74 
  75 ${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -fullversion
  76 
  77 ${TESTJAVA}${FS}bin${FS}javac *.java
  78 
  79 ${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -classpath . -Xdebug -Xrunjdwp:transport=dt_socket,address=8888,server=y,suspend=n SourceDebugExtension > test.out 2>&1 &
  80 
  81 P_PID=$!
  82 
  83 sleep 60
  84 STATUS=1
  85 
  86 grep "Test PASSES" test.out > ${NULL}
  87 if [ $? = 0 ]; then
  88     cat test.out
  89     STATUS=0
  90 fi
  91 
  92 exit $STATUS