Print this page
rev 4503 : 8009152: A number of jtreg tests need review/improvement
Summary: Added a new test_env.txt file to capture common shell variable. Added concept of COMPILEJAVA for use when TESTJAVA is a JRE. If COMPILEJAVA not set then TESTJAVA will be the default with assumption it is a JDK.
Reviewed-by: kvn, brutisso, coleenp
Split |
Split |
Close |
Expand all |
Collapse all |
--- old/test/runtime/7110720/Test7110720.sh
+++ new/test/runtime/7110720/Test7110720.sh
1 1 #
2 2 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 #
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
5 5
6 6
7 7 #
8 8 # @test Test7110720.sh
9 9 # @bug 7110720
10 10 # @summary improve VM configuration file loading
11 11 # @run shell Test7110720.sh
12 12 #
13 13
14 14 if [ "${TESTSRC}" = "" ]
15 - then TESTSRC=.
16 -fi
17 -
18 -if [ "${TESTJAVA}" = "" ]
19 15 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."
16 + TESTSRC=${PWD}
17 + echo "TESTSRC not set. Using "${TESTSRC}" as default"
24 18 fi
19 +echo "TESTSRC=${TESTSRC}"
20 +## Adding common setup Variables for running shell tests.
21 +. ${TESTSRC}/../../test_env.sh
25 22
26 -if [ "${TESTCLASSES}" = "" ]
27 -then
28 - echo "TESTCLASSES not set. Test cannot execute. Failed."
29 - exit 1
30 -fi
31 -
32 23 # Jtreg sets TESTVMOPTS which may include -d64 which is
33 24 # required to test a 64-bit JVM on some platforms.
34 25 # If another test harness still creates HOME/JDK64BIT,
35 26 # we can recognise that.
36 27
37 28 # set platform-dependent variables
38 29 OS=`uname -s`
39 30 case "$OS" in
40 31 SunOS | Linux | Darwin )
41 32 FS="/"
42 33 RM=/bin/rm
43 34 CP=/bin/cp
44 35 MV=/bin/mv
45 36 ## for solaris, linux it's HOME
46 37 FILE_LOCATION=$HOME
47 38 if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
48 39 then
49 40 TESTVMOPTS=`cat ${FILE_LOCATION}${FS}JDK64BIT`
50 41 fi
51 42 ;;
52 43 Windows_* )
53 44 FS="\\"
54 45 RM=rm
55 46 CP=cp
56 47 MV=mv
57 48 ;;
58 49 CYGWIN_* )
59 50 FS="/"
60 51 RM=rm
61 52 CP=cp
62 53 MV=mv
63 54 ;;
64 55 * )
65 56 echo "Unrecognized system!"
66 57 exit 1;
67 58 ;;
68 59 esac
69 60
70 61
71 62 JAVA=${TESTJAVA}${FS}bin${FS}java
72 63
73 64 # Don't test debug builds, they do read the config files:
74 65 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "debug" >/dev/null
75 66 if [ "$?" = "0" ]; then
76 67 echo Skipping test for debug build.
77 68 exit 0
78 69 fi
79 70
80 71 ok=yes
81 72
82 73 $RM -f .hotspot_compiler .hotspotrc
83 74
84 75 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
85 76 if [ "$?" = "0" ]; then
86 77 echo "FAILED: base case failure"
87 78 exit 1
88 79 fi
89 80
90 81
91 82 echo "garbage in, garbage out" > .hotspot_compiler
92 83 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
93 84 if [ "$?" = "0" ]; then
94 85 echo "FAILED: .hotspot_compiler was read"
95 86 ok=no
96 87 fi
97 88
98 89 $MV .hotspot_compiler hs_comp.txt
99 90 ${JAVA} ${TESTVMOPTS} -XX:CompileCommandFile=hs_comp.txt -version 2>&1 | grep "garbage in" >/dev/null
100 91 if [ "$?" = "1" ]; then
101 92 echo "FAILED: explicit compiler command file not read"
102 93 ok=no
103 94 fi
104 95
105 96 $RM -f .hotspot_compiler hs_comp.txt
106 97
107 98 echo "garbage" > .hotspotrc
108 99 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage" >/dev/null
109 100 if [ "$?" = "0" ]; then
110 101 echo "FAILED: .hotspotrc was read"
111 102 ok=no
112 103 fi
113 104
114 105 $MV .hotspotrc hs_flags.txt
115 106 ${JAVA} ${TESTVMOPTS} -XX:Flags=hs_flags.txt -version 2>&1 | grep "garbage" >/dev/null
116 107 if [ "$?" = "1" ]; then
117 108 echo "FAILED: explicit flags file not read"
118 109 ok=no
119 110 fi
120 111
121 112 if [ "${ok}" = "no" ]; then
122 113 echo "Some tests failed."
123 114 exit 1
124 115 else
125 116 echo "Passed"
126 117 exit 0
127 118 fi
128 119
↓ open down ↓ |
87 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX