test/runtime/7110720/Test7110720.sh

Fri, 28 Sep 2012 13:39:41 -0700

author
amurillo
date
Fri, 28 Sep 2012 13:39:41 -0700
changeset 4118
9f008ad79470
parent 4022
83b6305a5638
child 4831
04d6d4322c6a
permissions
-rw-r--r--

Added tag hs25-b03 for changeset f2e12eb74117

     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 #
     7 #
     8 # @test Test7110720.sh
     9 # @bug 7110720
    10 # @summary improve VM configuration file loading
    11 # @run shell Test7110720.sh
    12 #
    14 if [ "${TESTSRC}" = "" ]
    15   then TESTSRC=.
    16 fi
    18 if [ "${TESTJAVA}" = "" ]
    19 then
    20   PARENT=`dirname \`which java\``
    21   TESTJAVA=`dirname ${PARENT}`
    22   echo "TESTJAVA not set, selecting " ${TESTJAVA}
    23   echo "If this is incorrect, try setting the variable manually."
    24 fi
    26 if [ "${TESTCLASSES}" = "" ]
    27 then
    28   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
    29   exit 1
    30 fi
    32 # Jtreg sets TESTVMOPTS which may include -d64 which is
    33 # required to test a 64-bit JVM on some platforms.
    34 # If another test harness still creates HOME/JDK64BIT,
    35 # we can recognise that.
    37 # set platform-dependent variables
    38 OS=`uname -s`
    39 case "$OS" in
    40   SunOS | Linux | Darwin )
    41     FS="/"
    42     RM=/bin/rm
    43     CP=/bin/cp
    44     MV=/bin/mv
    45     ## for solaris, linux it's HOME
    46     FILE_LOCATION=$HOME
    47     if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
    48     then
    49         TESTVMOPTS=`cat ${FILE_LOCATION}${FS}JDK64BIT`
    50     fi
    51     ;;
    52   Windows_* )
    53     FS="\\"
    54     RM=rm
    55     CP=cp
    56     MV=mv
    57     ;;
    58   CYGWIN_* )
    59     FS="/"
    60     RM=rm
    61     CP=cp
    62     MV=mv
    63     ;;
    64   * )
    65     echo "Unrecognized system!"
    66     exit 1;
    67     ;;
    68 esac
    71 JAVA=${TESTJAVA}${FS}bin${FS}java
    73 # Don't test debug builds, they do read the config files:
    74 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "debug" >/dev/null
    75 if [ "$?" = "0" ]; then
    76   echo Skipping test for debug build.
    77   exit 0
    78 fi
    80 ok=yes
    82 $RM -f .hotspot_compiler .hotspotrc
    84 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
    85 if [ "$?" = "0" ]; then
    86   echo "FAILED: base case failure"
    87   exit 1
    88 fi
    91 echo "garbage in, garbage out" > .hotspot_compiler
    92 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
    93 if [ "$?" = "0" ]; then
    94   echo "FAILED: .hotspot_compiler was read"
    95   ok=no
    96 fi
    98 $MV .hotspot_compiler hs_comp.txt
    99 ${JAVA} ${TESTVMOPTS} -XX:CompileCommandFile=hs_comp.txt -version 2>&1 | grep "garbage in" >/dev/null
   100 if [ "$?" = "1" ]; then
   101   echo "FAILED: explicit compiler command file not read"
   102   ok=no
   103 fi
   105 $RM -f .hotspot_compiler hs_comp.txt
   107 echo "garbage" > .hotspotrc
   108 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage" >/dev/null
   109 if [ "$?" = "0" ]; then
   110   echo "FAILED: .hotspotrc was read"
   111   ok=no
   112 fi
   114 $MV .hotspotrc hs_flags.txt
   115 ${JAVA} ${TESTVMOPTS} -XX:Flags=hs_flags.txt -version 2>&1 | grep "garbage" >/dev/null
   116 if [ "$?" = "1" ]; then
   117   echo "FAILED: explicit flags file not read"
   118   ok=no
   119 fi
   121 if [ "${ok}" = "no" ]; then 
   122   echo "Some tests failed."
   123   exit 1
   124 else 
   125   echo "Passed"
   126   exit 0
   127 fi

mercurial