1 # |
|
2 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
|
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 # |
|
5 # This code is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License version 2 only, as |
|
7 # published by the Free Software Foundation. |
|
8 # |
|
9 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 # version 2 for more details (a copy is included in the LICENSE file that |
|
13 # accompanied this code). |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License version |
|
16 # 2 along with this work; if not, write to the Free Software Foundation, |
|
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 # |
|
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 # or visit www.oracle.com if you need additional information or have any |
|
21 # questions. |
|
22 # |
|
23 |
|
24 |
|
25 # @test Test8000968.sh |
|
26 # @bug 8000968 |
|
27 # @summary NPG: UseCompressedKlassPointers asserts with ObjectAlignmentInBytes=32 |
|
28 # @run shell Test8000968.sh |
|
29 # |
|
30 |
|
31 if [ "${TESTJAVA}" = "" ] |
|
32 then |
|
33 PARENT=`dirname \`which java\`` |
|
34 TESTJAVA=`dirname ${PARENT}` |
|
35 printf "TESTJAVA not set, selecting " ${TESTJAVA} |
|
36 printf " If this is incorrect, try setting the variable manually.\n" |
|
37 fi |
|
38 |
|
39 |
|
40 # set platform-dependent variables |
|
41 OS=`uname -s` |
|
42 case "$OS" in |
|
43 Windows_* ) |
|
44 FS="\\" |
|
45 NULL=NUL |
|
46 ;; |
|
47 * ) |
|
48 FS="/" |
|
49 NULL=/dev/null |
|
50 ;; |
|
51 esac |
|
52 |
|
53 JAVA=${TESTJAVA}${FS}bin${FS}java |
|
54 |
|
55 # |
|
56 # See if platform has 64 bit java. |
|
57 # |
|
58 ${JAVA} ${TESTVMOPTS} -d64 -version 2>&1 | grep -i "does not support" > ${NULL} |
|
59 if [ "$?" != "1" ] |
|
60 then |
|
61 printf "Platform is 32 bit, does not support -XX:ObjectAlignmentInBytes= option.\n" |
|
62 printf "Passed.\n" |
|
63 exit 0 |
|
64 fi |
|
65 |
|
66 # |
|
67 # Test -XX:ObjectAlignmentInBytes with -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops. |
|
68 # |
|
69 ${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=16 -version 2>&1 > ${NULL} |
|
70 if [ "$?" != "0" ] |
|
71 then |
|
72 printf "FAILED: -XX:ObjectAlignmentInBytes=16 option did not work.\n" |
|
73 exit 1 |
|
74 fi |
|
75 |
|
76 ${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=32 -version 2>&1 > ${NULL} |
|
77 if [ "$?" != "0" ] |
|
78 then |
|
79 printf "FAILED: -XX:ObjectAlignmentInBytes=32 option did not work.\n" |
|
80 exit 1 |
|
81 fi |
|
82 |
|
83 ${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=64 -version 2>&1 > ${NULL} |
|
84 if [ "$?" != "0" ] |
|
85 then |
|
86 printf "FAILED: -XX:ObjectAlignmentInBytes=64 option did not work.\n" |
|
87 exit 1 |
|
88 fi |
|
89 |
|
90 ${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=128 -version 2>&1 > ${NULL} |
|
91 if [ "$?" != "0" ] |
|
92 then |
|
93 printf "FAILED: -XX:ObjectAlignmentInBytes=128 option did not work.\n" |
|
94 exit 1 |
|
95 fi |
|
96 |
|
97 |
|
98 printf "Passed.\n" |
|
99 exit 0 |
|