author | mcimadamore |
Thu, 03 Feb 2011 09:38:19 +0000 | |
changeset 8239 | d2c934e951e2 |
parent 8222 | 28db72eee100 |
child 9087 | e9e44877cd18 |
permissions | -rw-r--r-- |
10 | 1 |
#! /bin/sh -f |
2 |
||
3 |
# |
|
5520 | 4 |
# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
# |
|
5520 | 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. |
|
10 | 24 |
# |
25 |
||
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 |
|
30 |
||
31 |
TS=${TESTSRC-.} |
|
32 |
TC=${TESTCLASSES-.} |
|
33 |
SCR=`pwd` |
|
34 |
||
35 |
if [ "${TESTJAVA}" = "" ] |
|
36 |
then |
|
37 |
echo "TESTJAVA not set. Test cannot execute. Failed." |
|
38 |
exit 1 |
|
39 |
fi |
|
40 |
||
41 |
# set platform-dependent variables |
|
42 |
OS=`uname -s` |
|
43 |
case "$OS" in |
|
44 |
SunOS | Linux ) |
|
45 |
FS="/" |
|
3772 | 46 |
SCR=`pwd` |
47 |
;; |
|
48 |
CYGWIN* ) |
|
49 |
FS="/" |
|
50 |
SCR=`pwd | cygpath -d` |
|
10 | 51 |
;; |
52 |
Windows* ) |
|
53 |
FS="\\" |
|
3772 | 54 |
SCR=`pwd` |
10 | 55 |
;; |
56 |
* ) |
|
57 |
echo "Unrecognized system!" |
|
58 |
exit 1; |
|
59 |
;; |
|
60 |
esac |
|
61 |
||
62 |
check() { |
|
63 |
expected=$1 |
|
64 |
shift |
|
65 |
||
66 |
# clean old classes |
|
67 |
rm -f ${TC}${FS}*.class |
|
68 |
||
8222
28db72eee100
6581775: Fix the white space problem in javac shell tests
jjg
parents:
5520
diff
changeset
|
69 |
echo "$@" |
28db72eee100
6581775: Fix the white space problem in javac shell tests
jjg
parents:
5520
diff
changeset
|
70 |
if "$@" 2>&1 ; then |
10 | 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 |
|
87 |
||
88 |
echo |
|
89 |
} |
|
90 |
||
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 |
|
96 |
||
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" |
|
100 |
||
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" |
|
106 |
||
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" |