author | mcimadamore |
Fri, 28 Apr 2017 11:06:51 +0100 | |
changeset 44882 | 76e64d614d7f |
parent 43394 | 68ed4de0f9c8 |
child 45823 | f3cf2ee05985 |
child 46225 | f99654379e9c |
permissions | -rw-r--r-- |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
1 |
/* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
4 |
* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
8 |
* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
13 |
* accompanied this code). |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
14 |
* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
18 |
* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
21 |
* questions. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
22 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
23 |
package requires; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
24 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
25 |
import java.io.IOException; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
26 |
import java.nio.file.Files; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
27 |
import java.nio.file.Paths; |
42511
8009d4cba2ea
8170228: register closed @requires property setter
iignatyev
parents:
42006
diff
changeset
|
28 |
import java.nio.file.StandardOpenOption; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
29 |
import java.util.ArrayList; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
30 |
import java.util.HashMap; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
31 |
import java.util.List; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
32 |
import java.util.Map; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
33 |
import java.util.concurrent.Callable; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
34 |
import java.util.regex.Matcher; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
35 |
import java.util.regex.Pattern; |
43389
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
36 |
|
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
37 |
import sun.hotspot.cpuinfo.CPUInfo; |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
38 |
import sun.hotspot.gc.GC; |
39941
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
39 |
import sun.hotspot.WhiteBox; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
40 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
41 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
42 |
* The Class to be invoked by jtreg prior Test Suite execution to |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
43 |
* collect information about VM. |
39941
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
44 |
* Do not use any API's that may not be available in all target VMs. |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
45 |
* Properties set by this Class will be available in the @requires expressions. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
46 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
47 |
public class VMProps implements Callable<Map<String, String>> { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
48 |
|
39941
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
49 |
private static final WhiteBox WB = WhiteBox.getWhiteBox(); |
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
50 |
|
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
51 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
52 |
* Collects information about VM properties. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
53 |
* This method will be invoked by jtreg. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
54 |
* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
55 |
* @return Map of property-value pairs. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
56 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
57 |
@Override |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
58 |
public Map<String, String> call() { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
59 |
Map<String, String> map = new HashMap<>(); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
60 |
map.put("vm.flavor", vmFlavor()); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
61 |
map.put("vm.compMode", vmCompMode()); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
62 |
map.put("vm.bits", vmBits()); |
39199
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
63 |
map.put("vm.flightRecorder", vmFlightRecorder()); |
39198
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
64 |
map.put("vm.simpleArch", vmArch()); |
42006
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
65 |
map.put("vm.debug", vmDebug()); |
42512
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
66 |
map.put("vm.jvmci", vmJvmci()); |
43394
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
67 |
map.put("vm.emulatedClient", vmEmulatedClient()); |
43389
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
68 |
map.put("vm.cpu.features", cpuFeatures()); |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
69 |
vmGC(map); // vm.gc.X = true/false |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
70 |
|
42511
8009d4cba2ea
8170228: register closed @requires property setter
iignatyev
parents:
42006
diff
changeset
|
71 |
VMProps.dump(map); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
72 |
return map; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
73 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
74 |
|
39198
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
75 |
/** |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
76 |
* @return vm.simpleArch value of "os.simpleArch" property of tested JDK. |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
77 |
*/ |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
78 |
protected String vmArch() { |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
79 |
String arch = System.getProperty("os.arch"); |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
80 |
if (arch.equals("x86_64") || arch.equals("amd64")) { |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
81 |
return "x64"; |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
82 |
} |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
83 |
else if (arch.contains("86")) { |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
84 |
return "x86"; |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
85 |
} else { |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
86 |
return arch; |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
87 |
} |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
88 |
} |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
89 |
|
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
90 |
|
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
91 |
|
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
92 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
93 |
* @return VM type value extracted from the "java.vm.name" property. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
94 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
95 |
protected String vmFlavor() { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
96 |
// E.g. "Java HotSpot(TM) 64-Bit Server VM" |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
97 |
String vmName = System.getProperty("java.vm.name"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
98 |
if (vmName == null) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
99 |
return null; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
100 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
101 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
102 |
Pattern startP = Pattern.compile(".* (\\S+) VM"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
103 |
Matcher m = startP.matcher(vmName); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
104 |
if (m.matches()) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
105 |
return m.group(1).toLowerCase(); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
106 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
107 |
return null; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
108 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
109 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
110 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
111 |
* @return VM compilation mode extracted from the "java.vm.info" property. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
112 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
113 |
protected String vmCompMode() { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
114 |
// E.g. "mixed mode" |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
115 |
String vmInfo = System.getProperty("java.vm.info"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
116 |
if (vmInfo == null) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
117 |
return null; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
118 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
119 |
int k = vmInfo.toLowerCase().indexOf(" mode"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
120 |
if (k < 0) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
121 |
return null; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
122 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
123 |
vmInfo = vmInfo.substring(0, k); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
124 |
switch (vmInfo) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
125 |
case "mixed" : return "Xmixed"; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
126 |
case "compiled" : return "Xcomp"; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
127 |
case "interpreted" : return "Xint"; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
128 |
default: return null; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
129 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
130 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
131 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
132 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
133 |
* @return VM bitness, the value of the "sun.arch.data.model" property. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
134 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
135 |
protected String vmBits() { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
136 |
return System.getProperty("sun.arch.data.model"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
137 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
138 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
139 |
/** |
39199
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
140 |
* @return "true" if Flight Recorder is enabled, "false" if is disabled. |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
141 |
*/ |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
142 |
protected String vmFlightRecorder() { |
39941
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
143 |
Boolean isUnlockedCommercialFatures = WB.getBooleanVMFlag("UnlockCommercialFeatures"); |
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
144 |
Boolean isFlightRecorder = WB.getBooleanVMFlag("FlightRecorder"); |
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
145 |
String startFROptions = WB.getStringVMFlag("StartFlightRecording"); |
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
146 |
if (isUnlockedCommercialFatures != null && isUnlockedCommercialFatures) { |
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
147 |
if (isFlightRecorder != null && isFlightRecorder) { |
39199
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
148 |
return "true"; |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
149 |
} |
39941
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
150 |
if (startFROptions != null && !startFROptions.isEmpty()) { |
39199
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
151 |
return "true"; |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
152 |
} |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
153 |
} |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
154 |
return "false"; |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
155 |
} |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
156 |
|
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
157 |
/** |
42006
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
158 |
* @return debug level value extracted from the "jdk.debug" property. |
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
159 |
*/ |
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
160 |
protected String vmDebug() { |
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
161 |
return "" + System.getProperty("jdk.debug").contains("debug"); |
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
162 |
} |
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
163 |
|
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
164 |
/** |
42512
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
165 |
* @return true if VM supports JVMCI and false otherwise |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
166 |
*/ |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
167 |
protected String vmJvmci() { |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
168 |
// builds with jvmci have this flag |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
169 |
return "" + (WB.getBooleanVMFlag("EnableJVMCI") != null); |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
170 |
} |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
171 |
|
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
172 |
/** |
43394
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
173 |
* @return true if VM runs in emulated-client mode and false otherwise. |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
174 |
*/ |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
175 |
protected String vmEmulatedClient() { |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
176 |
String vmInfo = System.getProperty("java.vm.info"); |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
177 |
if (vmInfo == null) { |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
178 |
return "false"; |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
179 |
} |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
180 |
return "" + vmInfo.contains(" emulated-client"); |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
181 |
} |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
182 |
|
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
183 |
/** |
43389
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
184 |
* @return supported CPU features |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
185 |
*/ |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
186 |
protected String cpuFeatures() { |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
187 |
return CPUInfo.getFeatures().toString(); |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
188 |
} |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
189 |
|
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
190 |
/** |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
191 |
* For all existing GC sets vm.gc.X property. |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
192 |
* Example vm.gc.G1=true means: |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
193 |
* VM supports G1 |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
194 |
* User either set G1 explicitely (-XX:+UseG1GC) or did not set any GC |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
195 |
* @param map - property-value pairs |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
196 |
*/ |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
197 |
protected void vmGC(Map<String, String> map){ |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
198 |
GC currentGC = GC.current(); |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
199 |
boolean isByErgo = GC.currentSetByErgo(); |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
200 |
List<GC> supportedGC = GC.allSupported(); |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
201 |
for (GC gc: GC.values()) { |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
202 |
boolean isSupported = supportedGC.contains(gc); |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
203 |
boolean isAcceptable = isSupported && (gc == currentGC || isByErgo); |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
204 |
map.put("vm.gc." + gc.name(), "" + isAcceptable); |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
205 |
} |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
206 |
} |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
207 |
|
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
208 |
/** |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
209 |
* Dumps the map to the file if the file name is given as the property. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
210 |
* This functionality could be helpful to know context in the real |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
211 |
* execution. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
212 |
* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
213 |
* @param map |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
214 |
*/ |
42511
8009d4cba2ea
8170228: register closed @requires property setter
iignatyev
parents:
42006
diff
changeset
|
215 |
protected static void dump(Map<String, String> map) { |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
216 |
String dumpFileName = System.getProperty("vmprops.dump"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
217 |
if (dumpFileName == null) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
218 |
return; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
219 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
220 |
List<String> lines = new ArrayList<>(); |
39199
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
221 |
map.forEach((k, v) -> lines.add(k + ":" + v)); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
222 |
try { |
42511
8009d4cba2ea
8170228: register closed @requires property setter
iignatyev
parents:
42006
diff
changeset
|
223 |
Files.write(Paths.get(dumpFileName), lines, StandardOpenOption.APPEND); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
224 |
} catch (IOException e) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
225 |
throw new RuntimeException("Failed to dump properties into '" |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
226 |
+ dumpFileName + "'", e); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
227 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
228 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
229 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
230 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
231 |
* This method is for the testing purpose only. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
232 |
* @param args |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
233 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
234 |
public static void main(String args[]) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
235 |
Map<String, String> map = new VMProps().call(); |
39199
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
236 |
map.forEach((k, v) -> System.out.println(k + ": '" + v + "'")); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
237 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
238 |
} |