Thu, 03 Feb 2011 09:36:28 +0000
5017953: spurious cascaded diagnostics when name not found
Summary: when an operator is applied to one or more erroneous operands, spurious diagnostics are generated
Reviewed-by: jjg
1 #! /bin/sh -f
3 #
4 # Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 #
7 # This code is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License version 2 only, as
9 # published by the Free Software Foundation.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
26 # @test
27 # @bug 4098712 6304984 6388453
28 # @summary check that source files inside zip files on the class path are ignored
29 # @run shell Test.sh
31 TS=${TESTSRC-.}
32 TC=${TESTCLASSES-.}
33 SCR=`pwd`
35 if [ "${TESTJAVA}" = "" ]
36 then
37 echo "TESTJAVA not set. Test cannot execute. Failed."
38 exit 1
39 fi
41 # set platform-dependent variables
42 OS=`uname -s`
43 case "$OS" in
44 SunOS | Linux )
45 FS="/"
46 SCR=`pwd`
47 ;;
48 CYGWIN* )
49 FS="/"
50 SCR=`pwd | cygpath -d`
51 ;;
52 Windows* )
53 FS="\\"
54 SCR=`pwd`
55 ;;
56 * )
57 echo "Unrecognized system!"
58 exit 1;
59 ;;
60 esac
62 check() {
63 expected=$1
64 shift
66 # clean old classes
67 rm -f ${TC}${FS}*.class
69 echo "$@"
70 if "$@" 2>&1 ; then
71 actual=ok
72 else
73 actual=err
74 fi
75 if [ "$actual" != "$expected" ]; then
76 case "$actual" in
77 ok ) echo "error: unexpected result: command succeeded" ;;
78 err ) echo "error: unexpected result: command failed"
79 esac
80 exit 1
81 else
82 case "$actual" in
83 ok ) echo "command succeeded as expected" ;;
84 err ) echo "command failed as expected."
85 esac
86 fi
88 echo
89 }
91 echo "# create zip/jar files with source code"
92 check ok "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.jar" -C "${TESTSRC}${FS}good" B.java
93 check ok "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.zip" -C "${TESTSRC}${FS}good" B.java
94 check ok "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.jar" -C "${TESTSRC}${FS}bad" B.java
95 check ok "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.zip" -C "${TESTSRC}${FS}bad" B.java
97 echo "# control tests, with no paths"
98 check ok "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}good${FS}B.java"
99 check err "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}bad${FS}B.java"
101 echo "# test that source files are found in directories on path"
102 check ok "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}good" "${TESTSRC}${FS}A.java"
103 check ok "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}good" "${TESTSRC}${FS}A.java"
104 check err "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}bad" "${TESTSRC}${FS}A.java"
105 check err "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}bad" "${TESTSRC}${FS}A.java"
107 echo "# test that source files are found in zip/jar files on path"
108 check ok "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.zip" "${TESTSRC}${FS}A.java"
109 check ok "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.jar" "${TESTSRC}${FS}A.java"
110 check err "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.zip" "${TESTSRC}${FS}A.java"
111 check err "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.jar" "${TESTSRC}${FS}A.java"