hotspot/test/runtime/7158988/TestFieldMonitor.sh
author kevinw
Fri, 11 May 2012 17:24:32 +0100
changeset 12729 684b5857e506
parent 12366 76be8878c0cd
child 13469 9a2973794d8c
permissions -rw-r--r--
7157734: hotspot test scripts not testing 64-bit JVM under JPRT/JTREG. Reviewed-by: kvn
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
# set platform-dependent variables
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    22
OS=`uname -s`
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    23
case "$OS" in
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    24
  SunOS | Linux )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    25
    NULL=/dev/null
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    26
    PS=":"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    27
    FS="/"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    28
    ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    29
  Windows_95 | Windows_98 | Windows_ME )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    30
    NULL=NUL
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    31
    PS=";"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    32
    FS="\\"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    33
    echo "Test skipped, only for WinNT"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    34
    exit 0
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    35
    ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    36
  Windows_NT )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    37
    NULL=NUL
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    38
    PS=";"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    39
    FS="\\"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    40
    ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    41
  * )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    42
    echo "Unrecognized system!"
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    43
    exit 1;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    44
    ;;
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    45
esac
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    46
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    47
#CLASSPATH=.${PS}${TESTCLASSES} ; export CLASSPATH
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
cp ${TESTSRC}${FS}*.java .
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    50
12729
684b5857e506 7157734: hotspot test scripts not testing 64-bit JVM under JPRT/JTREG.
kevinw
parents: 12366
diff changeset
    51
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion
12366
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
${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
    54
12729
684b5857e506 7157734: hotspot test scripts not testing 64-bit JVM under JPRT/JTREG.
kevinw
parents: 12366
diff changeset
    55
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar FieldMonitor > test.out 2>&1 &
12366
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
P_PID=$!
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
sleep 60
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    60
STATUS=0
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    61
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    62
case "$OS" in
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    63
    SunOS | Linux )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    64
        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
    65
        if [ $? = 0 ]; then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    66
            kill -9 $P_PID
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    67
            STATUS=1
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    68
        fi
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
      * )
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    71
        ps | grep -i "FieldMonitor" | grep -v grep > ${NULL}
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    72
        if [ $? = 0 ]; then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    73
            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
    74
            kill -s 9 $C_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
esac
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    79
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    80
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
    81
if [ $? = 0 ]; then
76be8878c0cd 7158988: jvm crashes while debugging on x86_32 and x86_64
coleenp
parents:
diff changeset
    82
    cat test.out
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
exit $STATUS