author | akulyakh |
Thu, 21 May 2015 11:41:04 -0700 | |
changeset 30730 | d3ce7619db2c |
parent 26100 | bb7dd001d190 |
child 36526 | 3b41f1c69604 |
permissions | -rw-r--r-- |
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
2 |
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
4 |
* |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
8 |
* |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
13 |
* accompanied this code). |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
14 |
* |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
18 |
* |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
21 |
* questions. |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
22 |
*/ |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
23 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
24 |
/* |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
25 |
* @test |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
26 |
* @bug 4204897 4256097 4785453 4863609 |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
27 |
* @summary Test that '.jar' files in -extdirs are found. |
26100 | 28 |
* @library /tools/lib |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
29 |
* @modules jdk.compiler/com.sun.tools.javac.api |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
30 |
* jdk.compiler/com.sun.tools.javac.file |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
31 |
* jdk.compiler/com.sun.tools.javac.main |
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
32 |
* @build ToolBox |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
33 |
* @run main ExtDirTest |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
34 |
*/ |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
35 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
36 |
import java.io.File; |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
37 |
|
26100 | 38 |
// Original test: test/tools/javac/ExtDirs/ExtDirs.sh |
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
39 |
public class ExtDirTest { |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
40 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
41 |
private static final String ExtDirTestClass1Src = |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
42 |
"package pkg1;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
43 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
44 |
"public class ExtDirTestClass1 {}"; |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
45 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
46 |
private static final String ExtDirTestClass2Src = |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
47 |
"package pkg2;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
48 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
49 |
"public class ExtDirTestClass2 {}"; |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
50 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
51 |
private static final String ExtDirTest_1Src = |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
52 |
"import pkg1.*;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
53 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
54 |
"public class ExtDirTest_1 {\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
55 |
" ExtDirTestClass1 x;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
56 |
"}"; |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
57 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
58 |
private static final String ExtDirTest_2Src = |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
59 |
"import pkg1.*;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
60 |
"import pkg2.*;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
61 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
62 |
"public class ExtDirTest_2 {\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
63 |
" ExtDirTestClass1 x;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
64 |
" ExtDirTestClass2 y;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
65 |
"}"; |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
66 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
67 |
private static final String ExtDirTest_3Src = |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
68 |
"import pkg1.*;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
69 |
"import pkg2.*;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
70 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
71 |
"public class ExtDirTest_3 {\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
72 |
" ExtDirTestClass1 x;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
73 |
" ExtDirTestClass2 y;\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
74 |
"}"; |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
75 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
76 |
private static final String jar1Manifest = |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
77 |
"Manifest-Version: 1.0\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
78 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
79 |
"Name: pkg1/ExtDirTestClass1.class\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
80 |
"Digest-Algorithms: SHA MD5 \n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
81 |
"SHA-Digest: 9HEcO9LJmND3cvOlq/AbUsbD9S0=\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
82 |
"MD5-Digest: hffPBwfqcUcnEdNv4PXu1Q==\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
83 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
84 |
"Name: pkg1/ExtDirTestClass1.java\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
85 |
"Digest-Algorithms: SHA MD5 \n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
86 |
"SHA-Digest: 2FQVe6w3n2Ma1ACYpe8a988EBU8=\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
87 |
"MD5-Digest: /Ivr4zVI9MSM26NmqWtZpQ==\n"; |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
88 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
89 |
private static final String jar2Manifest = |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
90 |
"Manifest-Version: 1.0\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
91 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
92 |
"Name: pkg2/ExtDirTestClass2.class\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
93 |
"Digest-Algorithms: SHA MD5 \n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
94 |
"SHA-Digest: elbPaqWf8hjj1+ZkkdW3PGTsilo=\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
95 |
"MD5-Digest: 57Nn0e2t1yEQfu/4kSw8yg==\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
96 |
"\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
97 |
"Name: pkg2/ExtDirTestClass2.java\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
98 |
"Digest-Algorithms: SHA MD5 \n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
99 |
"SHA-Digest: ILJOhwHg5US+yuw1Sc1d+Avu628=\n" + |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
100 |
"MD5-Digest: j8wnz8wneEcuJ/gjXBBQNA==\n"; |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
101 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
102 |
public static void main(String args[]) throws Exception { |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
103 |
new ExtDirTest().run(); |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
104 |
} |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
105 |
|
26100 | 106 |
private final ToolBox tb = new ToolBox(); |
107 |
||
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
108 |
void run() throws Exception { |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
109 |
createJars(); |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
110 |
compileWithExtDirs(); |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
111 |
} |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
112 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
113 |
void createJars() throws Exception { |
26100 | 114 |
tb.new JavacTask() |
115 |
.outdir(".") |
|
116 |
.sources(ExtDirTestClass1Src) |
|
117 |
.run(); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
118 |
|
26100 | 119 |
tb.new JarTask("pkg1.jar") |
120 |
.manifest(jar1Manifest) |
|
121 |
.files("pkg1/ExtDirTestClass1.class") |
|
122 |
.run(); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
123 |
|
26100 | 124 |
tb.new JavacTask() |
125 |
.outdir(".") |
|
126 |
.sources(ExtDirTestClass2Src) |
|
127 |
.run(); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
128 |
|
26100 | 129 |
tb.new JarTask("pkg2.jar") |
130 |
.manifest(jar2Manifest) |
|
131 |
.files("pkg2/ExtDirTestClass2.class") |
|
132 |
.run(); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
133 |
|
26100 | 134 |
tb.createDirectories("ext1", "ext2", "ext3"); |
135 |
tb.copyFile("pkg1.jar", "ext1"); |
|
136 |
tb.copyFile("pkg2.jar", "ext2"); |
|
137 |
tb.copyFile("pkg1.jar", "ext3"); |
|
138 |
tb.copyFile("pkg2.jar", "ext3"); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
139 |
|
26100 | 140 |
tb.deleteFiles( |
141 |
"pkg1.jar", |
|
142 |
"pkg2.jar", |
|
143 |
"pkg1/ExtDirTestClass1.class", |
|
144 |
"pkg1", |
|
145 |
"pkg2/ExtDirTestClass2.class", |
|
146 |
"pkg2" |
|
147 |
); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
148 |
} |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
149 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
150 |
void compileWithExtDirs() throws Exception { |
26100 | 151 |
tb.new JavacTask() |
152 |
.outdir(".") |
|
153 |
.options("-extdirs", "ext1") |
|
154 |
.sources(ExtDirTest_1Src) |
|
155 |
.run() |
|
156 |
.writeAll(); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
157 |
|
26100 | 158 |
tb.new JavacTask() |
159 |
.outdir(".") |
|
160 |
.options("-extdirs", "ext1" + File.pathSeparator + "ext2") |
|
161 |
.sources(ExtDirTest_2Src) |
|
162 |
.run(); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
163 |
|
26100 | 164 |
tb.new JavacTask() |
165 |
.outdir(".") |
|
166 |
.options("-extdirs", "ext3") |
|
167 |
.sources(ExtDirTest_3Src) |
|
168 |
.run(); |
|
16304
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
169 |
} |
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
170 |
|
475504933a2d
8006212: javac, convert jtreg tests from shell script to java
vromero
parents:
diff
changeset
|
171 |
} |