test/jtreg-ext/requires/VMProps.java
author goetz
Mon, 25 Jun 2018 23:04:21 +0200
changeset 50791 b1e90a8a876c
parent 50708 bd3a8f48597e
child 50908 7c51db95ccb6
permissions -rw-r--r--
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach Reviewed-by: jgeorge, cjplummer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
     1
/*
49008
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
     2
 * Copyright (c) 2016, 2018, 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;
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    40
import java.util.regex.Matcher;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    41
import java.util.regex.Pattern;
43389
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
    42
50455
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 50339
diff changeset
    43
import sun.hotspot.code.Compiler;
43389
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
    44
import sun.hotspot.cpuinfo.CPUInfo;
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
    45
import sun.hotspot.gc.GC;
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
    46
import sun.hotspot.WhiteBox;
46225
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
    47
import jdk.test.lib.Platform;
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    48
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
 * 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
    51
 * collect information about VM.
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
    52
 * 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
    53
 * 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
    54
 */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    55
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
    56
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
    57
    private static final WhiteBox WB = WhiteBox.getWhiteBox();
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
    58
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    59
    /**
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    60
     * Collects information about VM properties.
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    61
     * This method will be invoked by jtreg.
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    62
     *
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    63
     * @return Map of property-value pairs.
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    64
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    65
    @Override
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    66
    public Map<String, String> call() {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    67
        Map<String, String> map = new HashMap<>();
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    68
        map.put("vm.flavor", vmFlavor());
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    69
        map.put("vm.compMode", vmCompMode());
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    70
        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
    71
        map.put("vm.flightRecorder", vmFlightRecorder());
39198
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
    72
        map.put("vm.simpleArch", vmArch());
42006
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
    73
        map.put("vm.debug", vmDebug());
42512
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
    74
        map.put("vm.jvmci", vmJvmci());
43394
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
    75
        map.put("vm.emulatedClient", vmEmulatedClient());
50791
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
    76
        // 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
    77
        // and jhsdb.
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
    78
        map.put("vm.hasSA", vmHasSA());
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
    79
        // 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
    80
        // and jhsdb and it can attach to the VM.
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
    81
        map.put("vm.hasSAandCanAttach", vmHasSAandCanAttach());
43389
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
    82
        map.put("vm.cpu.features", cpuFeatures());
46225
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
    83
        map.put("vm.rtm.cpu", vmRTMCPU());
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
    84
        map.put("vm.rtm.os", vmRTMOS());
46238
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
    85
        map.put("vm.aot", vmAOT());
46242
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
    86
        // vm.cds is true if the VM is compiled with cds support.
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
    87
        map.put("vm.cds", vmCDS());
48155
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
    88
        map.put("vm.cds.custom.loaders", vmCDSForCustomLoaders());
49008
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
    89
        map.put("vm.cds.archived.java.heap", vmCDSForArchivedJavaHeap());
47576
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
    90
        // vm.graal.enabled is true if Graal is used as JIT
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
    91
        map.put("vm.graal.enabled", isGraalEnabled());
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
    92
        map.put("docker.support", dockerSupport());
50590
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
    93
        map.put("release.implementor", implementor());
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
    94
        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
    95
        vmOptFinalFlags(map);
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
    96
42511
8009d4cba2ea 8170228: register closed @requires property setter
iignatyev
parents: 42006
diff changeset
    97
        VMProps.dump(map);
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    98
        return map;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    99
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   100
39198
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   101
    /**
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   102
     * Prints a stack trace before returning null.
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   103
     * 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
   104
     * VM properties in the case where they don't find an expected property
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   105
     * or a propoerty doesn't conform to an expected format.
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   106
     *
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   107
     * @return null
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   108
     */
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   109
    private String nullWithException(String message) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   110
        new Exception(message).printStackTrace();
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   111
        return null;
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   112
    }
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   113
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   114
    /**
39198
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   115
     * @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
   116
     */
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   117
    protected String vmArch() {
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   118
        String arch = System.getProperty("os.arch");
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   119
        if (arch.equals("x86_64") || arch.equals("amd64")) {
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   120
            return "x64";
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   121
        }
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   122
        else if (arch.contains("86")) {
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   123
            return "x86";
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   124
        } else {
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   125
            return arch;
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   126
        }
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   127
    }
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   128
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   129
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   130
37400
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
     * @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
   133
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   134
    protected String vmFlavor() {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   135
        // 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
   136
        String vmName = System.getProperty("java.vm.name");
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   137
        if (vmName == null) {
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   138
            return nullWithException("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
   139
        }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   140
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   141
        Pattern startP = Pattern.compile(".* (\\S+) VM");
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   142
        Matcher m = startP.matcher(vmName);
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   143
        if (m.matches()) {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   144
            return m.group(1).toLowerCase();
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   145
        }
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   146
        return nullWithException("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
   147
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   148
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   149
    /**
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   150
     * @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
   151
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   152
    protected String vmCompMode() {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   153
        // E.g. "mixed mode"
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   154
        String vmInfo = System.getProperty("java.vm.info");
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   155
        if (vmInfo == null) {
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   156
            return nullWithException("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
   157
        }
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   158
        if (vmInfo.toLowerCase().indexOf("mixed mode") != -1) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   159
            return "Xmixed";
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   160
        } else if (vmInfo.toLowerCase().indexOf("compiled mode") != -1) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   161
            return "Xcomp";
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   162
        } else if (vmInfo.toLowerCase().indexOf("interpreted mode") != -1) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   163
            return "Xint";
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   164
        } else {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   165
            return nullWithException("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
   166
        }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   167
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   168
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   169
    /**
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   170
     * @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
   171
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   172
    protected String vmBits() {
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   173
        String dataModel = System.getProperty("sun.arch.data.model");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   174
        if (dataModel != null) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   175
            return dataModel;
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   176
        } else {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   177
            return nullWithException("Can't get 'sun.arch.data.model' property");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   178
        }
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   179
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   180
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   181
    /**
39199
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   182
     * @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
   183
     */
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   184
    protected String vmFlightRecorder() {
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
   185
        Boolean isFlightRecorder = WB.getBooleanVMFlag("FlightRecorder");
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
   186
        String startFROptions = WB.getStringVMFlag("StartFlightRecording");
50708
bd3a8f48597e 8202331: Obsolete support for commercial features
mikael
parents: 50590
diff changeset
   187
        if (isFlightRecorder != null && isFlightRecorder) {
bd3a8f48597e 8202331: Obsolete support for commercial features
mikael
parents: 50590
diff changeset
   188
            return "true";
bd3a8f48597e 8202331: Obsolete support for commercial features
mikael
parents: 50590
diff changeset
   189
        }
bd3a8f48597e 8202331: Obsolete support for commercial features
mikael
parents: 50590
diff changeset
   190
        if (startFROptions != null && !startFROptions.isEmpty()) {
bd3a8f48597e 8202331: Obsolete support for commercial features
mikael
parents: 50590
diff changeset
   191
            return "true";
39199
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   192
        }
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   193
        return "false";
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   194
    }
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   195
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   196
    /**
42006
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   197
     * @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
   198
     */
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   199
    protected String vmDebug() {
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   200
        String debug = System.getProperty("jdk.debug");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   201
        if (debug != null) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   202
            return "" + debug.contains("debug");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   203
        } else {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   204
            return nullWithException("Can't get 'jdk.debug' property");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   205
        }
42006
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   206
    }
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   207
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   208
    /**
42512
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   209
     * @return true if VM supports JVMCI and false otherwise
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   210
     */
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   211
    protected String vmJvmci() {
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   212
        // builds with jvmci have this flag
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   213
        return "" + (WB.getBooleanVMFlag("EnableJVMCI") != null);
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   214
    }
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   215
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   216
    /**
43394
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   217
     * @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
   218
     */
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   219
    protected String vmEmulatedClient() {
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   220
        String vmInfo = System.getProperty("java.vm.info");
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   221
        if (vmInfo == null) {
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   222
            return "false";
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   223
        }
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   224
        return "" + vmInfo.contains(" emulated-client");
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   225
    }
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   226
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   227
    /**
43389
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   228
     * @return supported CPU features
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   229
     */
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   230
    protected String cpuFeatures() {
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   231
        return CPUInfo.getFeatures().toString();
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   232
    }
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   233
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   234
    /**
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   235
     * For all existing GC sets vm.gc.X property.
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   236
     * Example vm.gc.G1=true means:
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   237
     *    VM supports G1
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   238
     *    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
   239
     * @param map - property-value pairs
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   240
     */
49630
2f1b308b4469 8199927: Make WhiteBox more GC agnostic
pliden
parents: 49344
diff changeset
   241
    protected void vmGC(Map<String, String> map) {
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   242
        for (GC gc: GC.values()) {
49630
2f1b308b4469 8199927: Make WhiteBox more GC agnostic
pliden
parents: 49344
diff changeset
   243
            boolean isAcceptable = gc.isSupported() && (gc.isSelected() || GC.isSelectedErgonomically());
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   244
            map.put("vm.gc." + gc.name(), "" + isAcceptable);
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   245
        }
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   246
    }
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   247
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   248
    /**
50320
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   249
     * Selected final flag.
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   250
     * @param map - property-value pairs
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   251
     * @param flagName - flag name
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   252
     */
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   253
    private void vmOptFinalFlag(Map<String, String> map, String flagName) {
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   254
        String value = WB.getBooleanVMFlag(flagName) ? "true" : "false";
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   255
        map.put("vm.opt.final." + flagName, value);
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   256
    }
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   257
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   258
    /**
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   259
     * Selected sets of final flags.
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   260
     * @param map -property-value pairs
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   261
     */
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   262
    protected void vmOptFinalFlags(Map<String, String> map) {
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   263
        vmOptFinalFlag(map, "ClassUnloading");
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   264
        vmOptFinalFlag(map, "UseCompressedOops");
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   265
    }
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   266
df02866807b6 8203923: Add @requires feature to check flag values for the running JVM
stefank
parents: 49630
diff changeset
   267
    /**
50791
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   268
     * @return "true" if VM has a serviceability agent.
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   269
     */
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   270
    protected String vmHasSA() {
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   271
        return "" + Platform.hasSA();
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   272
    }
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   273
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   274
    /**
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   275
     * @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
   276
     * attach to the VM.
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   277
     */
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   278
    protected String vmHasSAandCanAttach() {
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   279
        try {
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   280
            return "" + Platform.shouldSAAttach();
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   281
        } catch (IOException e) {
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   282
            System.out.println("Checking whether SA can attach to the VM failed.");
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   283
            e.printStackTrace();
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   284
            // Run the tests anyways.
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   285
            return "true";
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   286
        }
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   287
    }
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   288
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 50708
diff changeset
   289
    /**
46225
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   290
     * @return true if VM runs RTM supported OS and false otherwise.
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   291
     */
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   292
    protected String vmRTMOS() {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   293
        boolean isRTMOS = true;
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   294
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   295
        if (Platform.isAix()) {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   296
            // Actually, this works since AIX 7.1.3.30, but os.version property
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   297
            // is set to 7.1.
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   298
            isRTMOS = (Platform.getOsVersionMajor()  > 7) ||
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   299
                      (Platform.getOsVersionMajor() == 7 && Platform.getOsVersionMinor() > 1);
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   300
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   301
        } else if (Platform.isLinux()) {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   302
            if (Platform.isPPC()) {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   303
                isRTMOS = (Platform.getOsVersionMajor()  > 4) ||
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   304
                          (Platform.getOsVersionMajor() == 4 && Platform.getOsVersionMinor() > 1);
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   305
            }
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   306
        }
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   307
        return "" + isRTMOS;
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   308
    }
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   309
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   310
    /**
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   311
     * @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
   312
     */
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   313
    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
   314
        return "" + CPUInfo.hasFeature("rtm");
46225
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   315
    }
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   316
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   317
    /**
46238
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   318
     * @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
   319
     */
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   320
    protected String vmAOT() {
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   321
        // builds with aot have jaotc in <JDK>/bin
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   322
        Path bin = Paths.get(System.getProperty("java.home"))
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   323
                        .resolve("bin");
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   324
        Path jaotc;
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   325
        if (Platform.isWindows()) {
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   326
            jaotc = bin.resolve("jaotc.exe");
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   327
        } else {
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   328
            jaotc = bin.resolve("jaotc");
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   329
        }
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   330
        return "" + Files.exists(jaotc);
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   331
    }
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   332
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   333
    /**
46242
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   334
     * Check for CDS support.
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   335
     *
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   336
     * @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
   337
     */
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   338
    protected String vmCDS() {
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   339
        if (WB.isCDSIncludedInVmBuild()) {
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   340
            return "true";
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   341
        } else {
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   342
            return "false";
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   343
        }
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   344
    }
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   345
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   346
    /**
48155
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   347
     * 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
   348
     *
49008
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   349
     * @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
   350
     */
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   351
    protected String vmCDSForCustomLoaders() {
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   352
        if (vmCDS().equals("true") && Platform.areCustomLoadersSupportedForCDS()) {
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   353
            return "true";
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   354
        } else {
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   355
            return "false";
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   356
        }
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   357
    }
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   358
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   359
    /**
49008
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   360
     * 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
   361
     *
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   362
     * @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
   363
     */
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   364
    protected String vmCDSForArchivedJavaHeap() {
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   365
      if (vmCDS().equals("true") && WB.isJavaHeapArchiveSupported()) {
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   366
            return "true";
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   367
        } else {
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   368
            return "false";
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   369
        }
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   370
    }
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   371
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   372
    /**
47576
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   373
     * 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
   374
     *
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   375
     * @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
   376
     */
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   377
    protected String isGraalEnabled() {
50455
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 50339
diff changeset
   378
        return Compiler.isGraalEnabled() ? "true" : "false";
47576
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   379
    }
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   380
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   381
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   382
   /**
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   383
     * A simple check for docker support
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   384
     *
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   385
     * @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
   386
     */
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   387
    protected String dockerSupport() {
49344
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   388
        boolean isSupported = false;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   389
        if (Platform.isLinux()) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   390
           // currently docker testing is only supported for Linux,
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   391
           // on certain platforms
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   392
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   393
           String arch = System.getProperty("os.arch");
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   394
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   395
           if (Platform.isX64()) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   396
              isSupported = true;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   397
           }
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   398
           else if (Platform.isAArch64()) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   399
              isSupported = true;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   400
           }
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   401
           else if (Platform.isS390x()) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   402
              isSupported = true;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   403
           }
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   404
           else if (arch.equals("ppc64le")) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   405
              isSupported = true;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   406
           }
48880
ee49ac008730 8196062: Enable docker container related tests for linux ppc64le
mbaesken
parents: 48155
diff changeset
   407
        }
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   408
49344
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   409
        if (isSupported) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   410
           try {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   411
              isSupported = checkDockerSupport();
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   412
           } catch (Exception e) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   413
              isSupported = false;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   414
           }
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   415
         }
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   416
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   417
        return (isSupported) ? "true" : "false";
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   418
    }
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   419
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   420
    private boolean checkDockerSupport() throws IOException, InterruptedException {
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   421
        ProcessBuilder pb = new ProcessBuilder("docker", "ps");
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   422
        Process p = pb.start();
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   423
        p.waitFor(10, TimeUnit.SECONDS);
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 (p.exitValue() == 0);
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
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   428
50590
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   429
    private String implementor() {
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   430
        try (InputStream in = new BufferedInputStream(new FileInputStream(
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   431
                System.getProperty("java.home") + "/release"))) {
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   432
            Properties properties = new Properties();
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   433
            properties.load(in);
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   434
            return properties.getProperty("IMPLEMENTOR").replace("\"", "");
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   435
        } catch (IOException e) {
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   436
            e.printStackTrace();
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   437
        }
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   438
        return null;
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   439
    }
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 50455
diff changeset
   440
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   441
47576
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   442
    /**
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   443
     * 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
   444
     * 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
   445
     * execution.
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   446
     *
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   447
     * @param map
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   448
     */
42511
8009d4cba2ea 8170228: register closed @requires property setter
iignatyev
parents: 42006
diff changeset
   449
    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
   450
        String dumpFileName = System.getProperty("vmprops.dump");
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   451
        if (dumpFileName == null) {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   452
            return;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   453
        }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   454
        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
   455
        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
   456
        try {
42511
8009d4cba2ea 8170228: register closed @requires property setter
iignatyev
parents: 42006
diff changeset
   457
            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
   458
        } catch (IOException e) {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   459
            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
   460
                    + dumpFileName + "'", e);
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   461
        }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   462
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   463
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   464
    /**
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   465
     * 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
   466
     * @param args
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   467
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   468
    public static void main(String args[]) {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   469
        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
   470
        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
   471
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   472
}