author | goetz |
Thu, 03 Aug 2017 10:24:34 +0200 | |
changeset 46779 | d80ca591ae48 |
parent 46522 | 86b13b03a053 |
permissions | -rw-r--r-- |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
1 |
/* |
46389 | 2 |
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
4 |
* |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
8 |
* |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
13 |
* accompanied this code). |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
14 |
* |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
18 |
* |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
21 |
* questions. |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
22 |
*/ |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
23 |
|
46779
d80ca591ae48
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46522
diff
changeset
|
24 |
/** |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
25 |
* @test |
46779
d80ca591ae48
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46522
diff
changeset
|
26 |
* @requires vm.cds |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
27 |
* @summary Check to make sure that shared strings in the bootstrap CDS archive |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
28 |
* are actually shared |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
29 |
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
30 |
* @requires (sun.arch.data.model != "32") & (os.family != "windows") |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
31 |
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) |
39414
4adf52148100
8160088: update hotspot tests depending on GC to use @requires vm.gc.X
dfazunen
parents:
38008
diff
changeset
|
32 |
* @requires vm.gc.G1 |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39414
diff
changeset
|
33 |
* @library /test/lib |
36851 | 34 |
* @modules java.base/jdk.internal.misc |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
35 |
* java.management |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39414
diff
changeset
|
36 |
* @build SharedStringsWb sun.hotspot.WhiteBox |
37263
08dec586ed5c
8153300: [TESTBUG] Enhance test/testlibrary/ClassFileInstaller.java to support JAR files
iklam
parents:
36508
diff
changeset
|
37 |
* @run main ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
38 |
* @run main SharedStrings |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
39 |
*/ |
46389 | 40 |
|
41 |
import jdk.test.lib.cds.CDSTestUtils; |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39414
diff
changeset
|
42 |
import jdk.test.lib.process.ProcessTools; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39414
diff
changeset
|
43 |
import jdk.test.lib.process.OutputAnalyzer; |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
44 |
|
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
45 |
public class SharedStrings { |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
46 |
public static void main(String[] args) throws Exception { |
46389 | 47 |
// Note: This is a basic sanity test for Shared Strings feature. |
48 |
// This also serves as a reference on how to use this feature, |
|
49 |
// hence the command lines are spelled out instead of using the |
|
50 |
// test utils methods. |
|
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
51 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
52 |
"-XX:+UnlockDiagnosticVMOptions", |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
53 |
"-XX:SharedArchiveFile=./SharedStrings.jsa", |
38008
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
54 |
"-XX:+UseG1GC", |
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
55 |
"-XX:+UseCompressedOops", |
46522
86b13b03a053
8176132: -XX:+PrintSharedSpaces should be converted to use Unified Logging.
rprotacio
parents:
46389
diff
changeset
|
56 |
"-Xlog:cds,cds+hashtables", |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
57 |
// Needed for bootclasspath match, for CDS to work with WhiteBox API |
37263
08dec586ed5c
8153300: [TESTBUG] Enhance test/testlibrary/ClassFileInstaller.java to support JAR files
iklam
parents:
36508
diff
changeset
|
58 |
"-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"), |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
59 |
"-Xshare:dump"); |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
60 |
|
46389 | 61 |
OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "dump"); |
62 |
CDSTestUtils.checkDump(out, "Shared string table stats"); |
|
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
63 |
|
46389 | 64 |
|
65 |
pb = ProcessTools.createJavaProcessBuilder( |
|
38008
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
66 |
"-XX:+UnlockDiagnosticVMOptions", |
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
67 |
"-XX:SharedArchiveFile=./SharedStrings.jsa", |
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
68 |
// these are required modes for shared strings |
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
69 |
"-XX:+UseCompressedOops", "-XX:+UseG1GC", |
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
70 |
// needed for access to white box test API |
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
71 |
"-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"), |
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
72 |
"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", |
58732890050d
8154457: runtime/SharedArchiveFile/SharedStrings Shared string table stats missing
jiangli
parents:
37297
diff
changeset
|
73 |
"-Xshare:on", "-showversion", "SharedStringsWb"); |
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
74 |
|
46389 | 75 |
out = CDSTestUtils.executeAndLog(pb, "exec"); |
76 |
CDSTestUtils.checkExec(out); |
|
32179
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
77 |
} |
246b2ef581b2
8132214: [TESTBUG] Create basic shared strings test for CDS archive
mseledtsov
parents:
diff
changeset
|
78 |
} |