author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 58528 | d0519b8bd8d9 |
permissions | -rw-r--r-- |
54927 | 1 |
/* |
2 |
* Copyright (c) 2019, 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 |
import java.io.File; |
|
26 |
import java.nio.charset.Charset; |
|
27 |
import java.nio.file.Files; |
|
28 |
import java.nio.file.Path; |
|
29 |
import java.nio.file.Paths; |
|
30 |
import java.util.List; |
|
31 |
import java.util.ArrayList; |
|
32 |
||
33 |
/* |
|
34 |
* @test |
|
35 |
* @summary Try to archive lots of classes by searching for classes from the jrt:/ file system. With JDK 12 |
|
36 |
* this will produce an archive with over 30,000 classes. |
|
37 |
* @requires vm.cds |
|
57567
b000362a89a0
8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents:
54927
diff
changeset
|
38 |
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes |
54927 | 39 |
* @build LoadClasses |
40 |
* @build sun.hotspot.WhiteBox |
|
41 |
* @run driver ClassFileInstaller -jar loadclasses.jar LoadClasses |
|
42 |
* @run driver ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox |
|
43 |
* @run driver/timeout=500 DynamicLotsOfClasses |
|
44 |
*/ |
|
45 |
||
46 |
public class DynamicLotsOfClasses extends DynamicArchiveTestBase { |
|
47 |
||
58528
d0519b8bd8d9
8231529: [TESTBUG] runtime/cds/appcds/dynamicArchive/DynamicLotsOfClasses.java shouldn't wrap SkippedException into Exception
ccheung
parents:
57705
diff
changeset
|
48 |
public static void main(String[] args) throws Exception { |
54927 | 49 |
runTest(DynamicLotsOfClasses::testDefaultBase); |
50 |
} |
|
51 |
||
52 |
static void testDefaultBase() throws Exception { |
|
53 |
String topArchiveName = getNewArchiveName("top"); |
|
58528
d0519b8bd8d9
8231529: [TESTBUG] runtime/cds/appcds/dynamicArchive/DynamicLotsOfClasses.java shouldn't wrap SkippedException into Exception
ccheung
parents:
57705
diff
changeset
|
54 |
doTest(topArchiveName); |
54927 | 55 |
} |
56 |
||
58528
d0519b8bd8d9
8231529: [TESTBUG] runtime/cds/appcds/dynamicArchive/DynamicLotsOfClasses.java shouldn't wrap SkippedException into Exception
ccheung
parents:
57705
diff
changeset
|
57 |
private static void doTest(String topArchiveName) throws Exception { |
54927 | 58 |
ArrayList<String> list = new ArrayList<>(); |
59 |
TestCommon.findAllClasses(list); |
|
60 |
||
61 |
String classList = System.getProperty("user.dir") + File.separator + |
|
62 |
"LotsOfClasses.list"; |
|
63 |
List<String> lines = list; |
|
64 |
Path file = Paths.get(classList); |
|
65 |
Files.write(file, lines, Charset.forName("UTF-8")); |
|
66 |
||
67 |
String appJar = ClassFileInstaller.getJarPath("loadclasses.jar"); |
|
68 |
String mainClass = "LoadClasses"; |
|
69 |
||
70 |
String whiteBoxJar = ClassFileInstaller.getJarPath("whitebox.jar"); |
|
71 |
String bootClassPath = "-Xbootclasspath/a:" + whiteBoxJar; |
|
72 |
dump(topArchiveName, |
|
73 |
"--add-modules", |
|
74 |
"ALL-SYSTEM", |
|
75 |
"-Xlog:hashtables", |
|
76 |
"-Xmx500m", |
|
77 |
"-Xlog:cds,cds+dynamic", |
|
78 |
bootClassPath, |
|
79 |
"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", |
|
80 |
"-cp", appJar, mainClass, classList) |
|
81 |
.assertNormalExit(output -> { |
|
82 |
output.shouldContain("Buffer-space to target-space delta") |
|
83 |
.shouldContain("Written dynamic archive 0x"); |
|
84 |
}); |
|
85 |
} |
|
86 |
} |