hotspot/test/runtime/7110720/Test7110720.sh
changeset 24451 d340b077674f
parent 24450 6d5d6a0ca10a
child 24452 07e8e98ca6af
equal deleted inserted replaced
24450:6d5d6a0ca10a 24451:d340b077674f
     1 #
       
     2 #  Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
       
     3 #  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4 #
       
     5 
       
     6 
       
     7 #
       
     8 # @test Test7110720.sh
       
     9 # @bug 7110720
       
    10 # @summary improve VM configuration file loading
       
    11 # @run shell Test7110720.sh
       
    12 #
       
    13 
       
    14 if [ "${TESTSRC}" = "" ]
       
    15 then
       
    16   TESTSRC=${PWD}
       
    17   echo "TESTSRC not set.  Using "${TESTSRC}" as default"
       
    18 fi
       
    19 echo "TESTSRC=${TESTSRC}"
       
    20 ## Adding common setup Variables for running shell tests.
       
    21 . ${TESTSRC}/../../test_env.sh
       
    22 
       
    23 # Jtreg sets TESTVMOPTS which may include -d64 which is
       
    24 # required to test a 64-bit JVM on some platforms.
       
    25 # If another test harness still creates HOME/JDK64BIT,
       
    26 # we can recognise that.
       
    27 
       
    28 # set platform-dependent variables
       
    29 OS=`uname -s`
       
    30 case "$OS" in
       
    31   SunOS | Linux | Darwin )
       
    32     FS="/"
       
    33     RM=/bin/rm
       
    34     CP=/bin/cp
       
    35     MV=/bin/mv
       
    36     ## for solaris, linux it's HOME
       
    37     FILE_LOCATION=$HOME
       
    38     if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
       
    39     then
       
    40         TESTVMOPTS=`cat ${FILE_LOCATION}${FS}JDK64BIT`
       
    41     fi
       
    42     ;;
       
    43   Windows_* )
       
    44     FS="\\"
       
    45     RM=rm
       
    46     CP=cp
       
    47     MV=mv
       
    48     ;;
       
    49   CYGWIN_* )
       
    50     FS="/"
       
    51     RM=rm
       
    52     CP=cp
       
    53     MV=mv
       
    54     ;;
       
    55   * )
       
    56     echo "Unrecognized system!"
       
    57     exit 1;
       
    58     ;;
       
    59 esac
       
    60 
       
    61 
       
    62 JAVA=${TESTJAVA}${FS}bin${FS}java
       
    63 
       
    64 # Don't test debug builds, they do read the config files:
       
    65 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "debug" >/dev/null
       
    66 if [ "$?" = "0" ]; then
       
    67   echo Skipping test for debug build.
       
    68   exit 0
       
    69 fi
       
    70 
       
    71 ok=yes
       
    72 
       
    73 $RM -f .hotspot_compiler .hotspotrc
       
    74 
       
    75 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
       
    76 if [ "$?" = "0" ]; then
       
    77   echo "FAILED: base case failure"
       
    78   exit 1
       
    79 fi
       
    80 
       
    81 
       
    82 echo "garbage in, garbage out" > .hotspot_compiler
       
    83 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
       
    84 if [ "$?" = "0" ]; then
       
    85   echo "FAILED: .hotspot_compiler was read"
       
    86   ok=no
       
    87 fi
       
    88 
       
    89 $MV .hotspot_compiler hs_comp.txt
       
    90 ${JAVA} ${TESTVMOPTS} -XX:CompileCommandFile=hs_comp.txt -version 2>&1 | grep "garbage in" >/dev/null
       
    91 if [ "$?" = "1" ]; then
       
    92   echo "FAILED: explicit compiler command file not read"
       
    93   ok=no
       
    94 fi
       
    95 
       
    96 $RM -f .hotspot_compiler hs_comp.txt
       
    97 
       
    98 echo "garbage" > .hotspotrc
       
    99 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage" >/dev/null
       
   100 if [ "$?" = "0" ]; then
       
   101   echo "FAILED: .hotspotrc was read"
       
   102   ok=no
       
   103 fi
       
   104 
       
   105 $MV .hotspotrc hs_flags.txt
       
   106 ${JAVA} ${TESTVMOPTS} -XX:Flags=hs_flags.txt -version 2>&1 | grep "garbage" >/dev/null
       
   107 if [ "$?" = "1" ]; then
       
   108   echo "FAILED: explicit flags file not read"
       
   109   ok=no
       
   110 fi
       
   111 
       
   112 if [ "${ok}" = "no" ]; then 
       
   113   echo "Some tests failed."
       
   114   exit 1
       
   115 else 
       
   116   echo "Passed"
       
   117   exit 0
       
   118 fi
       
   119