Thu, 07 Jun 2012 20:30:57 -0700
7170079: Adjustments to build-infra makefiles
Reviewed-by: ohair, ohrstrom, ihse, jonas
Contributed-by: jonas <jonas.oreland@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
duke@1 | 1 | # |
ohair@962 | 2 | # Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | # |
duke@1 | 5 | # This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | # under the terms of the GNU General Public License version 2 only, as |
duke@1 | 7 | # published by the Free Software Foundation. |
duke@1 | 8 | # |
duke@1 | 9 | # This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 12 | # version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 13 | # accompanied this code). |
duke@1 | 14 | # |
duke@1 | 15 | # You should have received a copy of the GNU General Public License version |
duke@1 | 16 | # 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 17 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 18 | # |
ohair@554 | 19 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 20 | # or visit www.oracle.com if you need additional information or have any |
ohair@554 | 21 | # questions. |
duke@1 | 22 | # |
duke@1 | 23 | |
duke@1 | 24 | # @test |
darcy@1042 | 25 | # @bug 4981566 5028634 5094412 6304984 7025786 7025789 |
duke@1 | 26 | # @summary Check interpretation of -target and -source options |
duke@1 | 27 | # @build CheckClassFileVersion |
jjg@287 | 28 | # @run shell check.sh |
duke@1 | 29 | |
duke@1 | 30 | TESTJAVA=${TESTJAVA:?} |
duke@1 | 31 | TC=${TESTCLASSES-.} |
duke@1 | 32 | |
duke@1 | 33 | J="$TESTJAVA/bin/java" |
duke@1 | 34 | JC="$TESTJAVA/bin/javac" |
jjg@838 | 35 | CFV="${TESTVMOPTS} -cp $TC CheckClassFileVersion" |
duke@1 | 36 | |
duke@1 | 37 | rm -f $TC/X.java $TC/X.java |
duke@1 | 38 | echo 'public class X { }' > $TC/X.java |
duke@1 | 39 | echo 'public enum Y { }' > $TC/Y.java |
duke@1 | 40 | |
duke@1 | 41 | |
duke@1 | 42 | # Check class-file versions |
duke@1 | 43 | |
duke@1 | 44 | check() { |
duke@1 | 45 | V=$1; shift |
duke@1 | 46 | echo "+ javac $* [$V]" |
jjg@838 | 47 | "$JC" ${TESTTOOLVMOPTS} -d $TC $* $TC/X.java && "$J" $CFV $TC/X.class $V || exit 2 |
duke@1 | 48 | } |
duke@1 | 49 | |
duke@1 | 50 | check 48.0 -source 1.4 |
jjg@287 | 51 | |
duke@1 | 52 | check 49.0 -source 1.4 -target 1.5 |
jjg@287 | 53 | check 49.0 -source 1.5 -target 1.5 |
jjg@287 | 54 | |
jjg@287 | 55 | check 50.0 -source 1.4 -target 1.6 |
jjg@287 | 56 | check 50.0 -source 1.5 -target 1.6 |
jjg@287 | 57 | check 50.0 -source 1.6 -target 1.6 |
jjg@287 | 58 | check 50.0 -source 1.6 -target 6 |
jjg@287 | 59 | check 50.0 -source 6 -target 1.6 |
jjg@287 | 60 | check 50.0 -source 6 -target 6 |
jjg@287 | 61 | |
jjg@287 | 62 | check 51.0 |
jjg@287 | 63 | check 51.0 -source 1.5 |
jjg@287 | 64 | check 51.0 -source 1.6 |
jjg@287 | 65 | check 51.0 -source 6 |
jjg@287 | 66 | check 51.0 -source 1.7 |
jjg@287 | 67 | check 51.0 -source 7 |
darcy@1042 | 68 | check 51.0 -source 7 -target 1.7 |
darcy@1042 | 69 | check 51.0 -source 7 -target 7 |
duke@1 | 70 | |
darcy@1042 | 71 | # Update when class file version is revved |
darcy@1042 | 72 | check 51.0 -source 1.8 |
darcy@1042 | 73 | check 51.0 -source 8 |
darcy@1042 | 74 | check 51.0 -target 1.8 |
darcy@1042 | 75 | check 51.0 -target 8 |
duke@1 | 76 | |
duke@1 | 77 | # Check source versions |
duke@1 | 78 | |
duke@1 | 79 | fail() { |
duke@1 | 80 | echo "+ javac $*" |
jjg@838 | 81 | if "$JC" ${TESTTOOLVMOPTS} -d $TC $*; then |
duke@1 | 82 | echo "-- did not fail as expected" |
duke@1 | 83 | exit 3 |
duke@1 | 84 | else |
duke@1 | 85 | echo "-- failed as expected" |
duke@1 | 86 | fi |
duke@1 | 87 | } |
duke@1 | 88 | |
duke@1 | 89 | pass() { |
duke@1 | 90 | echo "+ javac $*" |
jjg@838 | 91 | if "$JC" ${TESTTOOLVMOPTS} -d $TC $*; then |
duke@1 | 92 | echo "-- passed" |
duke@1 | 93 | else |
duke@1 | 94 | echo "-- failed" |
duke@1 | 95 | exit 4 |
duke@1 | 96 | fi |
duke@1 | 97 | } |
duke@1 | 98 | |
jjg@287 | 99 | # the following need to be updated when -source 7 features are available |
duke@1 | 100 | checksrc14() { pass $* $TC/X.java; fail $* $TC/Y.java; } |
duke@1 | 101 | checksrc15() { pass $* $TC/X.java; pass $* $TC/Y.java; } |
duke@1 | 102 | checksrc16() { checksrc15 $* ; } |
jjg@287 | 103 | checksrc17() { checksrc15 $* ; } |
darcy@1042 | 104 | checksrc18() { checksrc15 $* ; } |
duke@1 | 105 | |
duke@1 | 106 | checksrc14 -source 1.4 |
duke@1 | 107 | checksrc14 -source 1.4 -target 1.5 |
duke@1 | 108 | |
duke@1 | 109 | checksrc15 -source 1.5 |
jjg@287 | 110 | checksrc15 -source 1.5 -target 1.5 |
duke@1 | 111 | |
duke@1 | 112 | checksrc16 -source 1.6 |
duke@1 | 113 | checksrc16 -source 6 |
jjg@287 | 114 | checksrc16 -source 1.6 -target 1.6 |
jjg@287 | 115 | checksrc16 -source 6 -target 6 |
jjg@287 | 116 | |
jjg@287 | 117 | checksrc17 -source 1.7 |
jjg@287 | 118 | checksrc17 -source 7 |
jjg@287 | 119 | checksrc17 -source 1.7 -target 1.7 |
jjg@287 | 120 | checksrc17 -source 7 -target 7 |
duke@1 | 121 | |
darcy@1042 | 122 | checksrc18 |
darcy@1042 | 123 | checksrc18 -target 1.8 |
darcy@1042 | 124 | checksrc18 -target 8 |
darcy@1042 | 125 | checksrc18 -source 1.8 |
darcy@1042 | 126 | checksrc18 -source 8 |
darcy@1042 | 127 | checksrc18 -source 1.8 -target 1.8 |
darcy@1042 | 128 | checksrc18 -source 8 -target 8 |
darcy@1042 | 129 | |
duke@1 | 130 | fail -source 1.5 -target 1.4 $TC/X.java |
duke@1 | 131 | fail -source 1.6 -target 1.4 $TC/X.java |
duke@1 | 132 | fail -source 6 -target 1.4 $TC/X.java |
duke@1 | 133 | fail -source 1.6 -target 1.5 $TC/X.java |
duke@1 | 134 | fail -source 6 -target 1.5 $TC/X.java |
darcy@1042 | 135 | fail -source 7 -target 1.6 $TC/X.java |
darcy@1042 | 136 | fail -source 8 -target 1.6 $TC/X.java |
darcy@1042 | 137 | fail -source 8 -target 1.7 $TC/X.java |