author | iignatyev |
Fri, 22 Feb 2019 14:39:57 -0800 | |
changeset 53906 | a6fb5e60588f |
parent 53575 | 297183cee278 |
child 54537 | 9d3117203dd3 |
permissions | -rw-r--r-- |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
1 |
/* |
53494
8fd43dacaef7
8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents:
51753
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
37400
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 |
|
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
25 |
import java.io.BufferedInputStream; |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
26 |
import java.io.FileInputStream; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
27 |
import java.io.IOException; |
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
28 |
import java.io.InputStream; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
29 |
import java.nio.file.Files; |
46238
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
30 |
import java.nio.file.Path; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
31 |
import java.nio.file.Paths; |
42511
8009d4cba2ea
8170228: register closed @requires property setter
iignatyev
parents:
42006
diff
changeset
|
32 |
import java.nio.file.StandardOpenOption; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
33 |
import java.util.ArrayList; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
34 |
import java.util.HashMap; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
35 |
import java.util.List; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
36 |
import java.util.Map; |
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
37 |
import java.util.Properties; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
38 |
import java.util.concurrent.Callable; |
47615
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
39 |
import java.util.concurrent.TimeUnit; |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
40 |
import java.util.function.Supplier; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
41 |
import java.util.regex.Matcher; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
42 |
import java.util.regex.Pattern; |
43389
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
43 |
|
50455
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
50339
diff
changeset
|
44 |
import sun.hotspot.code.Compiler; |
43389
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
45 |
import sun.hotspot.cpuinfo.CPUInfo; |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
46 |
import sun.hotspot.gc.GC; |
39941
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
47 |
import sun.hotspot.WhiteBox; |
46225
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
48 |
import jdk.test.lib.Platform; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
49 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
50 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
51 |
* 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
|
52 |
* collect information about VM. |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
53 |
* Do not use any APIs 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
|
54 |
* 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
|
55 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
56 |
public class VMProps implements Callable<Map<String, String>> { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
57 |
// value known to jtreg as an indicator of error state |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
58 |
private static final String ERROR_STATE = "__ERROR__"; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
59 |
|
39941
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
60 |
private static final WhiteBox WB = WhiteBox.getWhiteBox(); |
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
61 |
|
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
62 |
private static class SafeMap { |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
63 |
private final Map<String, String> map = new HashMap<>(); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
64 |
|
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
65 |
public void put(String key, Supplier<String> s) { |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
66 |
String value; |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
67 |
try { |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
68 |
value = s.get(); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
69 |
} catch (Throwable t) { |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
70 |
System.err.println("failed to get value for " + key); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
71 |
t.printStackTrace(System.err); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
72 |
value = ERROR_STATE + t; |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
73 |
} |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
74 |
map.put(key, value); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
75 |
} |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
76 |
} |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
77 |
|
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
78 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
79 |
* Collects information about VM properties. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
80 |
* This method will be invoked by jtreg. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
81 |
* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
82 |
* @return Map of property-value pairs. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
83 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
84 |
@Override |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
85 |
public Map<String, String> call() { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
86 |
SafeMap map = new SafeMap(); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
87 |
map.put("vm.flavor", this::vmFlavor); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
88 |
map.put("vm.compMode", this::vmCompMode); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
89 |
map.put("vm.bits", this::vmBits); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
90 |
map.put("vm.flightRecorder", this::vmFlightRecorder); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
91 |
map.put("vm.simpleArch", this::vmArch); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
92 |
map.put("vm.debug", this::vmDebug); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
93 |
map.put("vm.jvmci", this::vmJvmci); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
94 |
map.put("vm.emulatedClient", this::vmEmulatedClient); |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
95 |
// vm.hasSA is "true" if the VM contains the serviceability agent |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
96 |
// and jhsdb. |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
97 |
map.put("vm.hasSA", this::vmHasSA); |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
98 |
// vm.hasSAandCanAttach is "true" if the VM contains the serviceability agent |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
99 |
// and jhsdb and it can attach to the VM. |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
100 |
map.put("vm.hasSAandCanAttach", this::vmHasSAandCanAttach); |
51214 | 101 |
// vm.hasJFR is "true" if JFR is included in the build of the VM and |
102 |
// so tests can be executed. |
|
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
103 |
map.put("vm.hasJFR", this::vmHasJFR); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
104 |
map.put("vm.cpu.features", this::cpuFeatures); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
105 |
map.put("vm.rtm.cpu", this::vmRTMCPU); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
106 |
map.put("vm.rtm.compiler", this::vmRTMCompiler); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
107 |
map.put("vm.aot", this::vmAOT); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
108 |
map.put("vm.aot.enabled", this::vmAotEnabled); |
46242
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
109 |
// vm.cds is true if the VM is compiled with cds support. |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
110 |
map.put("vm.cds", this::vmCDS); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
111 |
map.put("vm.cds.custom.loaders", this::vmCDSForCustomLoaders); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
112 |
map.put("vm.cds.archived.java.heap", this::vmCDSForArchivedJavaHeap); |
47576
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
113 |
// vm.graal.enabled is true if Graal is used as JIT |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
114 |
map.put("vm.graal.enabled", this::isGraalEnabled); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
115 |
map.put("vm.compiler1.enabled", this::isCompiler1Enabled); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
116 |
map.put("vm.compiler2.enabled", this::isCompiler2Enabled); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
117 |
map.put("docker.support", this::dockerSupport); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
118 |
map.put("release.implementor", this::implementor); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
119 |
map.put("test.vm.gc.nvdimm", this::isNvdimmTestEnabled); |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
120 |
vmGC(map); // vm.gc.X = true/false |
50320
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
121 |
vmOptFinalFlags(map); |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
122 |
|
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
123 |
dump(map.map); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
124 |
return map.map; |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
125 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
126 |
|
39198
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
127 |
/** |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
128 |
* Print a stack trace before returning error state; |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
129 |
* Used by the various helper functions which parse information from |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
130 |
* VM properties in the case where they don't find an expected property |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
131 |
* or a property doesn't conform to an expected format. |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
132 |
* |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
133 |
* @return {@link #ERROR_STATE} |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
134 |
*/ |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
135 |
private String errorWithMessage(String message) { |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
136 |
new Exception(message).printStackTrace(); |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
137 |
return ERROR_STATE + message; |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
138 |
} |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
139 |
|
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
140 |
/** |
39198
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
141 |
* @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
|
142 |
*/ |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
143 |
protected String vmArch() { |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
144 |
String arch = System.getProperty("os.arch"); |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
145 |
if (arch.equals("x86_64") || arch.equals("amd64")) { |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
146 |
return "x64"; |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
147 |
} else if (arch.contains("86")) { |
39198
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
148 |
return "x86"; |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
149 |
} else { |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
150 |
return arch; |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
151 |
} |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
152 |
} |
050eff9d3bcf
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
37400
diff
changeset
|
153 |
|
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
154 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
155 |
* @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
|
156 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
157 |
protected String vmFlavor() { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
158 |
// 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
|
159 |
String vmName = System.getProperty("java.vm.name"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
160 |
if (vmName == null) { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
161 |
return errorWithMessage("Can't get 'java.vm.name' property"); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
162 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
163 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
164 |
Pattern startP = Pattern.compile(".* (\\S+) VM"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
165 |
Matcher m = startP.matcher(vmName); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
166 |
if (m.matches()) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
167 |
return m.group(1).toLowerCase(); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
168 |
} |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
169 |
return errorWithMessage("Can't get VM flavor from 'java.vm.name'"); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
170 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
171 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
172 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
173 |
* @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
|
174 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
175 |
protected String vmCompMode() { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
176 |
// E.g. "mixed mode" |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
177 |
String vmInfo = System.getProperty("java.vm.info"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
178 |
if (vmInfo == null) { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
179 |
return errorWithMessage("Can't get 'java.vm.info' property"); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
180 |
} |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
181 |
vmInfo = vmInfo.toLowerCase(); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
182 |
if (vmInfo.contains("mixed mode")) { |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
183 |
return "Xmixed"; |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
184 |
} else if (vmInfo.contains("compiled mode")) { |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
185 |
return "Xcomp"; |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
186 |
} else if (vmInfo.contains("interpreted mode")) { |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
187 |
return "Xint"; |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
188 |
} else { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
189 |
return errorWithMessage("Can't get compilation mode from 'java.vm.info'"); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
190 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
191 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
192 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
193 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
194 |
* @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
|
195 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
196 |
protected String vmBits() { |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
197 |
String dataModel = System.getProperty("sun.arch.data.model"); |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
198 |
if (dataModel != null) { |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
199 |
return dataModel; |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
200 |
} else { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
201 |
return errorWithMessage("Can't get 'sun.arch.data.model' property"); |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
202 |
} |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
203 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
204 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
205 |
/** |
39199
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
206 |
* @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
|
207 |
*/ |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
208 |
protected String vmFlightRecorder() { |
39941
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
209 |
Boolean isFlightRecorder = WB.getBooleanVMFlag("FlightRecorder"); |
fdbe314f004f
8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents:
39377
diff
changeset
|
210 |
String startFROptions = WB.getStringVMFlag("StartFlightRecording"); |
50708 | 211 |
if (isFlightRecorder != null && isFlightRecorder) { |
212 |
return "true"; |
|
213 |
} |
|
214 |
if (startFROptions != null && !startFROptions.isEmpty()) { |
|
215 |
return "true"; |
|
39199
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
216 |
} |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
217 |
return "false"; |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
218 |
} |
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
219 |
|
ec6fd961811c
8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents:
39198
diff
changeset
|
220 |
/** |
42006
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
221 |
* @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
|
222 |
*/ |
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
223 |
protected String vmDebug() { |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
224 |
String debug = System.getProperty("jdk.debug"); |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
225 |
if (debug != null) { |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
226 |
return "" + debug.contains("debug"); |
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
227 |
} else { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
228 |
return errorWithMessage("Can't get 'jdk.debug' property"); |
45823
f3cf2ee05985
8183534: [TEST] Make detection of compilation mode more robust
simonis
parents:
43394
diff
changeset
|
229 |
} |
42006
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
230 |
} |
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
231 |
|
98146f279bba
8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents:
39941
diff
changeset
|
232 |
/** |
42512
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
233 |
* @return true if VM supports JVMCI and false otherwise |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
234 |
*/ |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
235 |
protected String vmJvmci() { |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
236 |
// builds with jvmci have this flag |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
237 |
return "" + (WB.getBooleanVMFlag("EnableJVMCI") != null); |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
238 |
} |
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
239 |
|
9e1dfd06e954
8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents:
42511
diff
changeset
|
240 |
/** |
43394
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
241 |
* @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
|
242 |
*/ |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
243 |
protected String vmEmulatedClient() { |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
244 |
String vmInfo = System.getProperty("java.vm.info"); |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
245 |
if (vmInfo == null) { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
246 |
return errorWithMessage("Can't get 'java.vm.info' property"); |
43394
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
247 |
} |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
248 |
return "" + vmInfo.contains(" emulated-client"); |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
249 |
} |
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
250 |
|
68ed4de0f9c8
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
43389
diff
changeset
|
251 |
/** |
43389
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
252 |
* @return supported CPU features |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
253 |
*/ |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
254 |
protected String cpuFeatures() { |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
255 |
return CPUInfo.getFeatures().toString(); |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
256 |
} |
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
257 |
|
53ff01a9206a
8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents:
42512
diff
changeset
|
258 |
/** |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
259 |
* For all existing GC sets vm.gc.X property. |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
260 |
* Example vm.gc.G1=true means: |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
261 |
* VM supports G1 |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
262 |
* User either set G1 explicitely (-XX:+UseG1GC) or did not set any GC |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
263 |
* |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
264 |
* @param map - property-value pairs |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
265 |
*/ |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
266 |
protected void vmGC(SafeMap map) { |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
267 |
for (GC gc: GC.values()) { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
268 |
map.put("vm.gc." + gc.name(), |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
269 |
() -> "" + (gc.isSupported() |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
270 |
&& (gc.isSelected() || GC.isSelectedErgonomically()))); |
39377
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
271 |
} |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
272 |
} |
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
273 |
|
07739ee0b28a
8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents:
39199
diff
changeset
|
274 |
/** |
50320
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
275 |
* Selected final flag. |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
276 |
* |
50320
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
277 |
* @param map - property-value pairs |
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
278 |
* @param flagName - flag name |
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
279 |
*/ |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
280 |
private void vmOptFinalFlag(SafeMap map, String flagName) { |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
281 |
map.put("vm.opt.final." + flagName, |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
282 |
() -> String.valueOf(WB.getBooleanVMFlag(flagName))); |
50320
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
283 |
} |
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
284 |
|
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
285 |
/** |
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
286 |
* Selected sets of final flags. |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
287 |
* |
50908 | 288 |
* @param map - property-value pairs |
50320
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
289 |
*/ |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
290 |
protected void vmOptFinalFlags(SafeMap map) { |
50320
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
291 |
vmOptFinalFlag(map, "ClassUnloading"); |
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
292 |
vmOptFinalFlag(map, "UseCompressedOops"); |
50908 | 293 |
vmOptFinalFlag(map, "EnableJVMCI"); |
53497
2134c512a525
8167276: jvmci/compilerToVM/MaterializeVirtualObjectTest.java fails with -XX:-EliminateAllocations
iignatyev
parents:
53494
diff
changeset
|
294 |
vmOptFinalFlag(map, "EliminateAllocations"); |
50320
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
295 |
} |
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
296 |
|
df02866807b6
8203923: Add @requires feature to check flag values for the running JVM
stefank
parents:
49630
diff
changeset
|
297 |
/** |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
298 |
* @return "true" if VM has a serviceability agent. |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
299 |
*/ |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
300 |
protected String vmHasSA() { |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
301 |
return "" + Platform.hasSA(); |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
302 |
} |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
303 |
|
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
304 |
/** |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
305 |
* @return "true" if VM has a serviceability agent and it can |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
306 |
* attach to the VM. |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
307 |
*/ |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
308 |
protected String vmHasSAandCanAttach() { |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
309 |
try { |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
310 |
return "" + Platform.shouldSAAttach(); |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
311 |
} catch (IOException e) { |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
312 |
e.printStackTrace(); |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
313 |
return errorWithMessage("Checking whether SA can attach to the VM failed.:" + e); |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
314 |
} |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
315 |
} |
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
316 |
|
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
50708
diff
changeset
|
317 |
/** |
51214 | 318 |
* @return "true" if the VM is compiled with Java Flight Recorder (JFR) |
319 |
* support. |
|
320 |
*/ |
|
321 |
protected String vmHasJFR() { |
|
322 |
return "" + WB.isJFRIncludedInVmBuild(); |
|
323 |
} |
|
324 |
||
325 |
/** |
|
51753 | 326 |
* @return true if compiler in use supports RTM and false otherwise. |
46225
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
327 |
*/ |
51753 | 328 |
protected String vmRTMCompiler() { |
329 |
boolean isRTMCompiler = false; |
|
46225
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
330 |
|
51753 | 331 |
if (Compiler.isC2Enabled() && |
332 |
(Platform.isX86() || Platform.isX64() || Platform.isPPC())) { |
|
333 |
isRTMCompiler = true; |
|
46225
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
334 |
} |
51753 | 335 |
return "" + isRTMCompiler; |
46225
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
336 |
} |
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
337 |
|
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
338 |
/** |
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
339 |
* @return true if VM runs RTM supported CPU and false otherwise. |
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
340 |
*/ |
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
341 |
protected String vmRTMCPU() { |
50339
ede65c4fb6da
8203669: PPC64: Fix jtreg RTM tests after "8203305: Improve TM detection for enabling RTM on Linux / POWER9"
gromero
parents:
50320
diff
changeset
|
342 |
return "" + CPUInfo.hasFeature("rtm"); |
46225
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
343 |
} |
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
344 |
|
f99654379e9c
8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents:
43394
diff
changeset
|
345 |
/** |
46238
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
346 |
* @return true if VM supports AOT and false otherwise |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
347 |
*/ |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
348 |
protected String vmAOT() { |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
349 |
// builds with aot have jaotc in <JDK>/bin |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
350 |
Path bin = Paths.get(System.getProperty("java.home")) |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
351 |
.resolve("bin"); |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
352 |
Path jaotc; |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
353 |
if (Platform.isWindows()) { |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
354 |
jaotc = bin.resolve("jaotc.exe"); |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
355 |
} else { |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
356 |
jaotc = bin.resolve("jaotc"); |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
357 |
} |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
358 |
return "" + Files.exists(jaotc); |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
359 |
} |
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
360 |
|
53494
8fd43dacaef7
8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents:
51753
diff
changeset
|
361 |
/* |
8fd43dacaef7
8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents:
51753
diff
changeset
|
362 |
* @return true if there is at least one loaded AOT'ed library. |
8fd43dacaef7
8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents:
51753
diff
changeset
|
363 |
*/ |
8fd43dacaef7
8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents:
51753
diff
changeset
|
364 |
protected String vmAotEnabled() { |
8fd43dacaef7
8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents:
51753
diff
changeset
|
365 |
return "" + (WB.aotLibrariesCount() > 0); |
8fd43dacaef7
8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents:
51753
diff
changeset
|
366 |
} |
8fd43dacaef7
8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents:
51753
diff
changeset
|
367 |
|
46238
661b22bb24d2
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46225
diff
changeset
|
368 |
/** |
46242
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
369 |
* Check for CDS support. |
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
370 |
* |
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
371 |
* @return true if CDS is supported by the VM to be tested. |
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
372 |
*/ |
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
373 |
protected String vmCDS() { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
374 |
return "" + WB.isCDSIncludedInVmBuild(); |
46242
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
375 |
} |
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
376 |
|
9465c23e4e0d
8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents:
46239
diff
changeset
|
377 |
/** |
48155
551de50b4ff7
8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents:
47814
diff
changeset
|
378 |
* Check for CDS support for custom loaders. |
551de50b4ff7
8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents:
47814
diff
changeset
|
379 |
* |
49008
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
380 |
* @return true if CDS provides support for customer loader in the VM to be tested. |
48155
551de50b4ff7
8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents:
47814
diff
changeset
|
381 |
*/ |
551de50b4ff7
8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents:
47814
diff
changeset
|
382 |
protected String vmCDSForCustomLoaders() { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
383 |
return "" + ("true".equals(vmCDS()) && Platform.areCustomLoadersSupportedForCDS()); |
48155
551de50b4ff7
8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents:
47814
diff
changeset
|
384 |
} |
551de50b4ff7
8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents:
47814
diff
changeset
|
385 |
|
551de50b4ff7
8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents:
47814
diff
changeset
|
386 |
/** |
49008
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
387 |
* Check for CDS support for archived Java heap regions. |
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
388 |
* |
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
389 |
* @return true if CDS provides support for archive Java heap regions in the VM to be tested. |
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
390 |
*/ |
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
391 |
protected String vmCDSForArchivedJavaHeap() { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
392 |
return "" + ("true".equals(vmCDS()) && WB.isJavaHeapArchiveSupported()); |
49008
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
393 |
} |
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
394 |
|
d777541fceba
8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents:
48957
diff
changeset
|
395 |
/** |
47576
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
396 |
* Check if Graal is used as JIT compiler. |
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
397 |
* |
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
398 |
* @return true if Graal is used as JIT compiler. |
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
399 |
*/ |
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
400 |
protected String isGraalEnabled() { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
401 |
return "" + Compiler.isGraalEnabled(); |
47576
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
402 |
} |
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
403 |
|
51341 | 404 |
/** |
405 |
* Check if Compiler1 is present. |
|
406 |
* |
|
407 |
* @return true if Compiler1 is used as JIT compiler, either alone or as part of the tiered system. |
|
408 |
*/ |
|
409 |
protected String isCompiler1Enabled() { |
|
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
410 |
return "" + Compiler.isC1Enabled(); |
51341 | 411 |
} |
412 |
||
413 |
/** |
|
414 |
* Check if Compiler2 is present. |
|
415 |
* |
|
416 |
* @return true if Compiler2 is used as JIT compiler, either alone or as part of the tiered system. |
|
417 |
*/ |
|
418 |
protected String isCompiler2Enabled() { |
|
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
419 |
return "" + Compiler.isC2Enabled(); |
51341 | 420 |
} |
47615
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
421 |
|
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
422 |
/** |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
423 |
* A simple check for docker support |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
424 |
* |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
425 |
* @return true if docker is supported in a given environment |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
426 |
*/ |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
427 |
protected String dockerSupport() { |
49344
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
428 |
boolean isSupported = false; |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
429 |
if (Platform.isLinux()) { |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
430 |
// currently docker testing is only supported for Linux, |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
431 |
// on certain platforms |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
432 |
|
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
433 |
String arch = System.getProperty("os.arch"); |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
434 |
|
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
435 |
if (Platform.isX64()) { |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
436 |
isSupported = true; |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
437 |
} else if (Platform.isAArch64()) { |
49344
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
438 |
isSupported = true; |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
439 |
} else if (Platform.isS390x()) { |
49344
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
440 |
isSupported = true; |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
441 |
} else if (arch.equals("ppc64le")) { |
49344
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
442 |
isSupported = true; |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
443 |
} |
48880
ee49ac008730
8196062: Enable docker container related tests for linux ppc64le
mbaesken
parents:
48155
diff
changeset
|
444 |
} |
47615
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
445 |
|
49344
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
446 |
if (isSupported) { |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
447 |
try { |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
448 |
isSupported = checkDockerSupport(); |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
449 |
} catch (Exception e) { |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
450 |
isSupported = false; |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
451 |
} |
e55d7a31cfa7
8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents:
49008
diff
changeset
|
452 |
} |
47615
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
453 |
|
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
454 |
return "" + isSupported; |
47615
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
455 |
} |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
456 |
|
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
457 |
private boolean checkDockerSupport() throws IOException, InterruptedException { |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
458 |
ProcessBuilder pb = new ProcessBuilder("docker", "ps"); |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
459 |
Process p = pb.start(); |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
460 |
p.waitFor(10, TimeUnit.SECONDS); |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
461 |
|
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
462 |
return (p.exitValue() == 0); |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
463 |
} |
6210a27c3704
8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents:
47576
diff
changeset
|
464 |
|
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
465 |
private String implementor() { |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
466 |
try (InputStream in = new BufferedInputStream(new FileInputStream( |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
467 |
System.getProperty("java.home") + "/release"))) { |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
468 |
Properties properties = new Properties(); |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
469 |
properties.load(in); |
51191
96fae3a62612
8208157: requires.VMProps throws NPE for missing properties in "release" file
shurailine
parents:
50914
diff
changeset
|
470 |
String implementorProperty = properties.getProperty("IMPLEMENTOR"); |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
471 |
if (implementorProperty != null) { |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
472 |
return implementorProperty.replace("\"", ""); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
473 |
} |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
474 |
return errorWithMessage("Can't get 'IMPLEMENTOR' property from 'release' file"); |
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
475 |
} catch (IOException e) { |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
476 |
e.printStackTrace(); |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
477 |
return errorWithMessage("Failed to read 'release' file " + e); |
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
478 |
} |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
479 |
} |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
50455
diff
changeset
|
480 |
|
53575
297183cee278
8217666: gc/nvdimm/* should not be included any tiers
sangheki
parents:
53497
diff
changeset
|
481 |
private String isNvdimmTestEnabled() { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
482 |
String isEnabled = System.getenv("TEST_VM_GC_NVDIMM"); |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
483 |
return "" + "true".equalsIgnoreCase(isEnabled); |
53575
297183cee278
8217666: gc/nvdimm/* should not be included any tiers
sangheki
parents:
53497
diff
changeset
|
484 |
} |
297183cee278
8217666: gc/nvdimm/* should not be included any tiers
sangheki
parents:
53497
diff
changeset
|
485 |
|
47576
7645833d326f
8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents:
46242
diff
changeset
|
486 |
/** |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
487 |
* 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
|
488 |
* 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
|
489 |
* execution. |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
490 |
* |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
491 |
* @param map |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
492 |
*/ |
42511
8009d4cba2ea
8170228: register closed @requires property setter
iignatyev
parents:
42006
diff
changeset
|
493 |
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
|
494 |
String dumpFileName = System.getProperty("vmprops.dump"); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
495 |
if (dumpFileName == null) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
496 |
return; |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
497 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
498 |
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
|
499 |
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
|
500 |
try { |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
501 |
Files.write(Paths.get(dumpFileName), lines, |
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
502 |
StandardOpenOption.APPEND, StandardOpenOption.CREATE); |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
503 |
} catch (IOException e) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
504 |
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
|
505 |
+ dumpFileName + "'", e); |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
506 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
507 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
508 |
|
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
509 |
/** |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
510 |
* This method is for the testing purpose only. |
53906
a6fb5e60588f
8209807: improve handling exception in requires.VMProps
iignatyev
parents:
53575
diff
changeset
|
511 |
* |
37400
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
512 |
* @param args |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
513 |
*/ |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
514 |
public static void main(String args[]) { |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
515 |
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
|
516 |
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
|
517 |
} |
7a596e23c0da
8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff
changeset
|
518 |
} |