author | rriggs |
Wed, 12 Apr 2017 11:43:49 -0400 | |
changeset 44633 | d2f5e8921045 |
parent 42640 | 09dba077f1e7 |
child 46389 | d55896236dfd |
permissions | -rw-r--r-- |
22517 | 1 |
/* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39213
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
22517 | 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 |
* @test DefaultUseWithClient |
|
26 |
* @summary Test default behavior of sharing with -client |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39213
diff
changeset
|
27 |
* @library /test/lib |
36851 | 28 |
* @modules java.base/jdk.internal.misc |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
23442
diff
changeset
|
29 |
* java.management |
22517 | 30 |
* @run main DefaultUseWithClient |
22892
1709e0e0b87c
8034898: [TESTBUG]: Zero failure project - tag all Runtime JTReg bugs that fail nightly
gtriantafill
parents:
22517
diff
changeset
|
31 |
* @bug 8032224 |
22517 | 32 |
*/ |
33 |
||
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39213
diff
changeset
|
34 |
import jdk.test.lib.process.ProcessTools; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39213
diff
changeset
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39213
diff
changeset
|
36 |
import jdk.test.lib.Platform; |
22517 | 37 |
import java.io.File; |
38 |
||
39 |
public class DefaultUseWithClient { |
|
40 |
public static void main(String[] args) throws Exception { |
|
30123
7a8b6bd85e24
8075438: [TESTBUG] Hotspot JTREG tests should use unique CDS archive names
ctornqvi
parents:
23442
diff
changeset
|
41 |
String fileName = "DefaultUseWithClient.jsa"; |
22517 | 42 |
|
43 |
// On 32-bit windows CDS should be on by default in "-client" config |
|
44 |
// Skip this test on any other platform |
|
45 |
boolean is32BitWindows = (Platform.isWindows() && Platform.is32bit()); |
|
46 |
if (!is32BitWindows) { |
|
47 |
System.out.println("Test only applicable on 32-bit Windows. Skipping"); |
|
48 |
return; |
|
49 |
} |
|
50 |
||
51 |
// create the archive |
|
52 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
|
53 |
"-XX:+UnlockDiagnosticVMOptions", |
|
54 |
"-XX:SharedArchiveFile=./" + fileName, |
|
55 |
"-Xshare:dump"); |
|
56 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
|
57 |
output.shouldHaveExitValue(0); |
|
58 |
||
59 |
pb = ProcessTools.createJavaProcessBuilder( |
|
60 |
"-XX:+UnlockDiagnosticVMOptions", |
|
61 |
"-XX:SharedArchiveFile=./" + fileName, |
|
62 |
"-client", |
|
23442
be6bd2c1f2a8
8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception
mseledtsov
parents:
22892
diff
changeset
|
63 |
"-XX:+PrintSharedSpaces", |
22517 | 64 |
"-version"); |
65 |
||
66 |
output = new OutputAnalyzer(pb.start()); |
|
23442
be6bd2c1f2a8
8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception
mseledtsov
parents:
22892
diff
changeset
|
67 |
try { |
be6bd2c1f2a8
8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception
mseledtsov
parents:
22892
diff
changeset
|
68 |
output.shouldContain("sharing"); |
be6bd2c1f2a8
8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception
mseledtsov
parents:
22892
diff
changeset
|
69 |
} catch (RuntimeException e) { |
be6bd2c1f2a8
8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception
mseledtsov
parents:
22892
diff
changeset
|
70 |
// if sharing failed due to ASLR or similar reasons, |
be6bd2c1f2a8
8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception
mseledtsov
parents:
22892
diff
changeset
|
71 |
// check whether sharing was attempted at all (UseSharedSpaces) |
be6bd2c1f2a8
8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception
mseledtsov
parents:
22892
diff
changeset
|
72 |
output.shouldContain("UseSharedSpaces:"); |
be6bd2c1f2a8
8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception
mseledtsov
parents:
22892
diff
changeset
|
73 |
} |
22517 | 74 |
output.shouldHaveExitValue(0); |
75 |
} |
|
76 |
} |