test/jtreg-ext/requires/VMProps.java
author goetz
Mon, 16 Apr 2018 11:08:07 +0200
changeset 49705 68ac1caf3d7e
parent 49630 2f1b308b4469
child 50320 df02866807b6
permissions -rw-r--r--
8201584: Fix configure on SLES 11 after 8201483 Reviewed-by: ihse, simonis
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
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    25
import java.io.IOException;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    26
import java.nio.file.Files;
46238
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
    27
import java.nio.file.Path;
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    28
import java.nio.file.Paths;
42511
8009d4cba2ea 8170228: register closed @requires property setter
iignatyev
parents: 42006
diff changeset
    29
import java.nio.file.StandardOpenOption;
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    30
import java.util.ArrayList;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    31
import java.util.HashMap;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    32
import java.util.List;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    33
import java.util.Map;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    34
import java.util.concurrent.Callable;
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
    35
import java.util.concurrent.TimeUnit;
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    36
import java.util.regex.Matcher;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    37
import java.util.regex.Pattern;
43389
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
    38
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
    39
import sun.hotspot.cpuinfo.CPUInfo;
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
    40
import sun.hotspot.gc.GC;
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
    41
import sun.hotspot.WhiteBox;
46225
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
    42
import jdk.test.lib.Platform;
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    43
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    44
/**
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    45
 * 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
    46
 * collect information about VM.
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
    47
 * 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
    48
 * 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
    49
 */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    50
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
    51
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
    52
    private static final WhiteBox WB = WhiteBox.getWhiteBox();
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
    53
37400
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
     * Collects information about VM properties.
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    56
     * This method will be invoked by jtreg.
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    57
     *
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    58
     * @return Map of property-value pairs.
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
    @Override
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    61
    public Map<String, String> call() {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    62
        Map<String, String> map = new HashMap<>();
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    63
        map.put("vm.flavor", vmFlavor());
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    64
        map.put("vm.compMode", vmCompMode());
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    65
        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
    66
        map.put("vm.flightRecorder", vmFlightRecorder());
39198
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
    67
        map.put("vm.simpleArch", vmArch());
42006
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
    68
        map.put("vm.debug", vmDebug());
42512
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
    69
        map.put("vm.jvmci", vmJvmci());
43394
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
    70
        map.put("vm.emulatedClient", vmEmulatedClient());
43389
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
    71
        map.put("vm.cpu.features", cpuFeatures());
46225
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
    72
        map.put("vm.rtm.cpu", vmRTMCPU());
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
    73
        map.put("vm.rtm.os", vmRTMOS());
46238
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
    74
        map.put("vm.aot", vmAOT());
46242
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
    75
        // 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
    76
        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
    77
        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
    78
        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
    79
        // 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
    80
        map.put("vm.graal.enabled", isGraalEnabled());
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
    81
        map.put("docker.support", dockerSupport());
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
    82
        vmGC(map); // vm.gc.X = true/false
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
    83
42511
8009d4cba2ea 8170228: register closed @requires property setter
iignatyev
parents: 42006
diff changeset
    84
        VMProps.dump(map);
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    85
        return map;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    86
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
    87
39198
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
    88
    /**
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
    89
     * Prints a stack trace before returning null.
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
    90
     * 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
    91
     * 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
    92
     * 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
    93
     *
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
    94
     * @return null
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
    95
     */
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
    96
    private String nullWithException(String message) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
    97
        new Exception(message).printStackTrace();
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
    98
        return null;
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
    99
    }
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   100
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   101
    /**
39198
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   102
     * @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
   103
     */
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   104
    protected String vmArch() {
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   105
        String arch = System.getProperty("os.arch");
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   106
        if (arch.equals("x86_64") || arch.equals("amd64")) {
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   107
            return "x64";
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   108
        }
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   109
        else if (arch.contains("86")) {
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   110
            return "x86";
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   111
        } else {
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   112
            return arch;
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   113
        }
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   114
    }
050eff9d3bcf 8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents: 37400
diff changeset
   115
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
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   118
    /**
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   119
     * @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
   120
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   121
    protected String vmFlavor() {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   122
        // 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
   123
        String vmName = System.getProperty("java.vm.name");
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   124
        if (vmName == null) {
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   125
            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
   126
        }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   127
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   128
        Pattern startP = Pattern.compile(".* (\\S+) VM");
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   129
        Matcher m = startP.matcher(vmName);
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   130
        if (m.matches()) {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   131
            return m.group(1).toLowerCase();
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   132
        }
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   133
        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
   134
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   135
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   136
    /**
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   137
     * @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
   138
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   139
    protected String vmCompMode() {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   140
        // E.g. "mixed mode"
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   141
        String vmInfo = System.getProperty("java.vm.info");
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   142
        if (vmInfo == null) {
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   143
            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
   144
        }
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   145
        if (vmInfo.toLowerCase().indexOf("mixed mode") != -1) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   146
            return "Xmixed";
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   147
        } else if (vmInfo.toLowerCase().indexOf("compiled mode") != -1) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   148
            return "Xcomp";
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   149
        } else if (vmInfo.toLowerCase().indexOf("interpreted mode") != -1) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   150
            return "Xint";
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   151
        } else {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   152
            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
   153
        }
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
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
     * @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
   158
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   159
    protected String vmBits() {
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   160
        String dataModel = System.getProperty("sun.arch.data.model");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   161
        if (dataModel != null) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   162
            return dataModel;
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   163
        } else {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   164
            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
   165
        }
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
    /**
39199
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   169
     * @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
   170
     */
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   171
    protected String vmFlightRecorder() {
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
   172
        Boolean isUnlockedCommercialFatures = WB.getBooleanVMFlag("UnlockCommercialFeatures");
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
   173
        Boolean isFlightRecorder = WB.getBooleanVMFlag("FlightRecorder");
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
   174
        String startFROptions = WB.getStringVMFlag("StartFlightRecording");
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
   175
        if (isUnlockedCommercialFatures != null && isUnlockedCommercialFatures) {
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
   176
            if (isFlightRecorder != null && isFlightRecorder) {
39199
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   177
                return "true";
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   178
            }
39941
fdbe314f004f 8161208: Unable to run jtreg tests with MinimalVM
mchernov
parents: 39377
diff changeset
   179
            if (startFROptions != null && !startFROptions.isEmpty()) {
39199
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   180
                return "true";
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   181
            }
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   182
        }
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   183
        return "false";
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   184
    }
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   185
ec6fd961811c 8158412: [TESTBUG] TestIHOPErgo and TestStressG1Humongous should not be executed when JFR is enabled
mchernov
parents: 39198
diff changeset
   186
    /**
42006
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   187
     * @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
   188
     */
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   189
    protected String vmDebug() {
45823
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   190
        String debug = System.getProperty("jdk.debug");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   191
        if (debug != null) {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   192
            return "" + debug.contains("debug");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   193
        } else {
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   194
            return nullWithException("Can't get 'jdk.debug' property");
f3cf2ee05985 8183534: [TEST] Make detection of compilation mode more robust
simonis
parents: 43394
diff changeset
   195
        }
42006
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   196
    }
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   197
98146f279bba 8155219: [TESTBUG] Rewrite compiler/ciReplay/TestVM.sh in java
dpochepk
parents: 39941
diff changeset
   198
    /**
42512
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   199
     * @return true if VM supports JVMCI and false otherwise
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   200
     */
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   201
    protected String vmJvmci() {
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   202
        // builds with jvmci have this flag
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   203
        return "" + (WB.getBooleanVMFlag("EnableJVMCI") != null);
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   204
    }
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   205
9e1dfd06e954 8170226: Implement setting jtreg @requires property vm.jvmci
iignatyev
parents: 42511
diff changeset
   206
    /**
43394
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   207
     * @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
   208
     */
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   209
    protected String vmEmulatedClient() {
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   210
        String vmInfo = System.getProperty("java.vm.info");
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   211
        if (vmInfo == null) {
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   212
            return "false";
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   213
        }
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   214
        return "" + vmInfo.contains(" emulated-client");
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   215
    }
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   216
68ed4de0f9c8 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 43389
diff changeset
   217
    /**
43389
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   218
     * @return supported CPU features
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   219
     */
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   220
    protected String cpuFeatures() {
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   221
        return CPUInfo.getFeatures().toString();
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   222
    }
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   223
53ff01a9206a 8170918: Remove shell script from test/compiler/c2/cr7200264/TestIntVect.java
bmoloden
parents: 42512
diff changeset
   224
    /**
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   225
     * For all existing GC sets vm.gc.X property.
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   226
     * Example vm.gc.G1=true means:
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   227
     *    VM supports G1
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   228
     *    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
   229
     * @param map - property-value pairs
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   230
     */
49630
2f1b308b4469 8199927: Make WhiteBox more GC agnostic
pliden
parents: 49344
diff changeset
   231
    protected void vmGC(Map<String, String> map) {
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   232
        for (GC gc: GC.values()) {
49630
2f1b308b4469 8199927: Make WhiteBox more GC agnostic
pliden
parents: 49344
diff changeset
   233
            boolean isAcceptable = gc.isSupported() && (gc.isSelected() || GC.isSelectedErgonomically());
39377
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   234
            map.put("vm.gc." + gc.name(), "" + isAcceptable);
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   235
        }
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   236
    }
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   237
07739ee0b28a 8151283: Implement setting jtreg @requires property vm.isG1Supported.
dfazunen
parents: 39199
diff changeset
   238
    /**
46225
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   239
     * @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
   240
     */
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   241
    protected String vmRTMOS() {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   242
        boolean isRTMOS = true;
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   243
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   244
        if (Platform.isAix()) {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   245
            // 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
   246
            // is set to 7.1.
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   247
            isRTMOS = (Platform.getOsVersionMajor()  > 7) ||
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   248
                      (Platform.getOsVersionMajor() == 7 && Platform.getOsVersionMinor() > 1);
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   249
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   250
        } else if (Platform.isLinux()) {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   251
            if (Platform.isPPC()) {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   252
                isRTMOS = (Platform.getOsVersionMajor()  > 4) ||
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   253
                          (Platform.getOsVersionMajor() == 4 && Platform.getOsVersionMinor() > 1);
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   254
            }
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   255
        }
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   256
        return "" + isRTMOS;
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   257
    }
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   258
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   259
    /**
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   260
     * @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
   261
     */
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   262
    protected String vmRTMCPU() {
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   263
        boolean vmRTMCPU = (Platform.isPPC() ? CPUInfo.hasFeature("tcheck") : CPUInfo.hasFeature("rtm"));
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   264
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   265
        return "" + vmRTMCPU;
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   266
    }
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   267
f99654379e9c 8181124: Get rid of compiler.testlibrary.rtm.predicate
epavlova
parents: 43394
diff changeset
   268
    /**
46238
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   269
     * @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
   270
     */
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   271
    protected String vmAOT() {
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   272
        // builds with aot have jaotc in <JDK>/bin
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   273
        Path bin = Paths.get(System.getProperty("java.home"))
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   274
                        .resolve("bin");
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   275
        Path jaotc;
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   276
        if (Platform.isWindows()) {
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   277
            jaotc = bin.resolve("jaotc.exe");
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   278
        } else {
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   279
            jaotc = bin.resolve("jaotc");
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   280
        }
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   281
        return "" + Files.exists(jaotc);
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   282
    }
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   283
661b22bb24d2 8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents: 46225
diff changeset
   284
    /**
46242
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   285
     * Check for CDS support.
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   286
     *
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   287
     * @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
   288
     */
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   289
    protected String vmCDS() {
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   290
        if (WB.isCDSIncludedInVmBuild()) {
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   291
            return "true";
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   292
        } else {
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   293
            return "false";
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   294
        }
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   295
    }
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   296
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46239
diff changeset
   297
    /**
48155
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   298
     * 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
   299
     *
49008
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   300
     * @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
   301
     */
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   302
    protected String vmCDSForCustomLoaders() {
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   303
        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
   304
            return "true";
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   305
        } else {
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   306
            return "false";
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   307
        }
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   308
    }
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   309
551de50b4ff7 8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
iklam
parents: 47814
diff changeset
   310
    /**
49008
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   311
     * 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
   312
     *
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   313
     * @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
   314
     */
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   315
    protected String vmCDSForArchivedJavaHeap() {
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   316
      if (vmCDS().equals("true") && WB.isJavaHeapArchiveSupported()) {
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   317
            return "true";
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   318
        } else {
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   319
            return "false";
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   320
        }
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   321
    }
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   322
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48957
diff changeset
   323
    /**
47576
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   324
     * 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
   325
     *
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   326
     * @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
   327
     */
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   328
    protected String isGraalEnabled() {
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   329
        // Graal is enabled if following conditions are true:
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   330
        // - we are not in Interpreter mode
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   331
        // - UseJVMCICompiler flag is true
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   332
        // - jvmci.Compiler variable is equal to 'graal'
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   333
        // - TieredCompilation is not used or TieredStopAtLevel is greater than 3
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   334
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   335
        Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler");
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   336
        if (useCompiler == null || !useCompiler)
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   337
            return "false";
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   338
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   339
        Boolean useJvmciComp = WB.getBooleanVMFlag("UseJVMCICompiler");
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   340
        if (useJvmciComp == null || !useJvmciComp)
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   341
            return "false";
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   342
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   343
        // This check might be redundant but let's keep it for now.
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   344
        String jvmciCompiler = System.getProperty("jvmci.Compiler");
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   345
        if (jvmciCompiler == null || !jvmciCompiler.equals("graal")) {
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   346
            return "false";
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   347
        }
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   348
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   349
        Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation");
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   350
        Long compLevel = WB.getIntxVMFlag("TieredStopAtLevel");
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   351
        // if TieredCompilation is enabled and compilation level is <= 3 then no Graal is used
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   352
        if (tieredCompilation != null && tieredCompilation && compLevel != null && compLevel <= 3)
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   353
            return "false";
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   354
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   355
        return "true";
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   356
    }
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   357
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   358
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   359
   /**
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   360
     * A simple check for docker support
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   361
     *
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   362
     * @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
   363
     */
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   364
    protected String dockerSupport() {
49344
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   365
        boolean isSupported = false;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   366
        if (Platform.isLinux()) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   367
           // currently docker testing is only supported for Linux,
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   368
           // on certain platforms
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   369
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   370
           String arch = System.getProperty("os.arch");
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   371
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   372
           if (Platform.isX64()) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   373
              isSupported = true;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   374
           }
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   375
           else if (Platform.isAArch64()) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   376
              isSupported = true;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   377
           }
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   378
           else if (Platform.isS390x()) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   379
              isSupported = true;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   380
           }
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   381
           else if (arch.equals("ppc64le")) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   382
              isSupported = true;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   383
           }
48880
ee49ac008730 8196062: Enable docker container related tests for linux ppc64le
mbaesken
parents: 48155
diff changeset
   384
        }
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   385
49344
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   386
        if (isSupported) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   387
           try {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   388
              isSupported = checkDockerSupport();
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   389
           } catch (Exception e) {
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   390
              isSupported = false;
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   391
           }
e55d7a31cfa7 8196590: Enable docker container related tests for linux AARCH64
dsamersoff
parents: 49008
diff changeset
   392
         }
47615
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   393
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   394
        return (isSupported) ? "true" : "false";
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   395
    }
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   396
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   397
    private boolean checkDockerSupport() throws IOException, InterruptedException {
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   398
        ProcessBuilder pb = new ProcessBuilder("docker", "ps");
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   399
        Process p = pb.start();
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   400
        p.waitFor(10, TimeUnit.SECONDS);
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   401
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   402
        return (p.exitValue() == 0);
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   403
    }
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   404
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   405
6210a27c3704 8181592: [TESTBUG] Docker test utils and docker jdk basic test
mseledtsov
parents: 47576
diff changeset
   406
47576
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 46242
diff changeset
   407
    /**
37400
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   408
     * 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
   409
     * 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
   410
     * execution.
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   411
     *
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   412
     * @param map
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   413
     */
42511
8009d4cba2ea 8170228: register closed @requires property setter
iignatyev
parents: 42006
diff changeset
   414
    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
   415
        String dumpFileName = System.getProperty("vmprops.dump");
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   416
        if (dumpFileName == null) {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   417
            return;
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   418
        }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   419
        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
   420
        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
   421
        try {
42511
8009d4cba2ea 8170228: register closed @requires property setter
iignatyev
parents: 42006
diff changeset
   422
            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
   423
        } catch (IOException e) {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   424
            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
   425
                    + dumpFileName + "'", e);
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   426
        }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   427
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   428
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   429
    /**
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   430
     * 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
   431
     * @param args
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   432
     */
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   433
    public static void main(String args[]) {
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   434
        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
   435
        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
   436
    }
7a596e23c0da 8152432: Implement setting jtreg @requires properties vm.flavor, vm.bits, vm.compMode
dfazunen
parents:
diff changeset
   437
}