hotspot/test/runtime/7158988/TestFieldMonitor.sh
author coleenp
Thu, 05 Apr 2012 12:17:52 -0400
changeset 12366 76be8878c0cd
child 12729 684b5857e506
permissions -rw-r--r--
7158988: jvm crashes while debugging on x86_32 and x86_64 Summary: Object pointer is pushed more than once on stack, where GC doesn't expect it. Reviewed-by: coleenp, kvn Contributed-by: axel.siebenborn@sap.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12366
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     1
#!/bin/sh
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     2
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     3
if [ "${TESTSRC}" = "" ]
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     4
then TESTSRC=.
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     5
fi
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     6
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     7
if [ "${TESTJAVA}" = "" ]
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     8
then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
     9
  PARENT=`dirname \`which java\``
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    10
  TESTJAVA=`dirname ${PARENT}`
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    11
  echo "TESTJAVA not set, selecting " ${TESTJAVA}
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    12
  echo "If this is incorrect, try setting the variable manually."
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    13
fi
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    14
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    15
if [ "${TESTCLASSES}" = "" ]
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    16
then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    17
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    18
  exit 1
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    19
fi
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    20
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    21
BIT_FLAG=""
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    22
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    23
# set platform-dependent variables
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    24
OS=`uname -s`
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    25
case "$OS" in
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    26
  SunOS | Linux )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    27
    NULL=/dev/null
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    28
    PS=":"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    29
    FS="/"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    30
    ## for solaris, linux it's HOME
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    31
    FILE_LOCATION=$HOME
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    32
    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" -a `uname -p`='sparc' ]
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    33
    then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    34
        BIT_FLAG="-d64"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    35
    fi
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    36
    ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    37
  Windows_95 | Windows_98 | Windows_ME )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    38
    NULL=NUL
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    39
    PS=";"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    40
    FS="\\"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    41
    echo "Test skipped, only for WinNT"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    42
    exit 0
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    43
    ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    44
  Windows_NT )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    45
    NULL=NUL
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    46
    PS=";"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    47
    FS="\\"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    48
    ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    49
  * )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    50
    echo "Unrecognized system!"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    51
    exit 1;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    52
    ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    53
esac
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    54
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    55
#CLASSPATH=.${PS}${TESTCLASSES} ; export CLASSPATH
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    56
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    57
cp ${TESTSRC}${FS}*.java .
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    58
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    59
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -fullversion
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    60
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    61
${TESTJAVA}${FS}bin${FS}javac -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar *.java
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    62
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    63
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar FieldMonitor > test.out 2>&1 &
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    64
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    65
P_PID=$!
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    66
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    67
sleep 60
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    68
STATUS=0
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    69
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    70
case "$OS" in
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    71
    SunOS | Linux )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    72
        ps -ef | grep $P_PID | grep -v grep > ${NULL}
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    73
        if [ $? = 0 ]; then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    74
            kill -9 $P_PID
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    75
            STATUS=1
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    76
        fi
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    77
        ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    78
      * )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    79
        ps | grep -i "FieldMonitor" | grep -v grep > ${NULL}
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    80
        if [ $? = 0 ]; then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    81
            C_PID=`ps | grep -i "FieldMonitor" | awk '{print $1}'`
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    82
            kill -s 9 $C_PID
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    83
            STATUS=1
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    84
        fi
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    85
        ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    86
esac
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    87
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    88
grep "A fatal error has been detected" test.out > ${NULL}
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    89
if [ $? = 0 ]; then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    90
    cat test.out
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    91
    STATUS=1
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    92
fi
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    93
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    94
exit $STATUS