hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java
changeset 44584 8cd22f56bfca
parent 43972 1ade39b8381b
equal deleted inserted replaced
44509:02253db2ace1 44584:8cd22f56bfca
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    28  * @library / /test/lib
    28  * @library / /test/lib
    29  * @library ../common/patches
    29  * @library ../common/patches
    30  * @modules java.base/jdk.internal.misc
    30  * @modules java.base/jdk.internal.misc
    31  * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
    31  * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
    32  * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
    32  * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
    33  * @run main/othervm compiler.jvmci.compilerToVM.DebugOutputTest
    33  * @run driver compiler.jvmci.compilerToVM.DebugOutputTest
    34  */
    34  */
    35 
       
    36  // as soon as CODETOOLS-7901589 fixed, '@run main/othervm' should be replaced w/ '@run driver'
       
    37 
    35 
    38 package compiler.jvmci.compilerToVM;
    36 package compiler.jvmci.compilerToVM;
    39 
    37 
    40 import jdk.test.lib.process.OutputAnalyzer;
    38 import jdk.test.lib.process.OutputAnalyzer;
    41 import jdk.test.lib.process.ProcessTools;
    39 import jdk.test.lib.process.ProcessTools;
    42 import jdk.vm.ci.hotspot.CompilerToVMHelper;
    40 import jdk.vm.ci.hotspot.CompilerToVMHelper;
    43 
    41 
    44 import java.util.Arrays;
    42 import java.util.Arrays;
       
    43 import java.nio.file.Path;
       
    44 import java.nio.file.Paths;
    45 
    45 
    46 public class DebugOutputTest {
    46 public class DebugOutputTest {
       
    47     private static final String VM_CI_MODULE = "jdk.internal.vm.ci";
    47     public static void main(String[] args) {
    48     public static void main(String[] args) {
    48         new DebugOutputTest().test();
    49         new DebugOutputTest().test();
    49     }
    50     }
    50 
    51 
    51     private void test() {
    52     private void test() {
    52         for (TestCaseData testCase : TestCaseData.values()) {
    53         for (TestCaseData testCase : TestCaseData.values()) {
    53             System.out.println(testCase);
    54             System.out.println(testCase);
    54             OutputAnalyzer oa;
    55             OutputAnalyzer oa;
    55             try {
    56             try {
    56                 oa = ProcessTools.executeTestJvmAllArgs(
    57                 Path patch = Paths.get(System.getProperty("test.patch.path"));
       
    58                 Path jvmciPath = patch.resolve(VM_CI_MODULE).toAbsolutePath();
       
    59                 if (!jvmciPath.toFile().exists()) {
       
    60                     throw new Error("TESTBUG: patch for " + VM_CI_MODULE + " : "
       
    61                             + jvmciPath.toString() + " does not exist");
       
    62                 }
       
    63                 oa = ProcessTools.executeTestJvm(
    57                         "-XX:+UnlockExperimentalVMOptions",
    64                         "-XX:+UnlockExperimentalVMOptions",
    58                         "-XX:+EnableJVMCI",
    65                         "-XX:+EnableJVMCI",
    59                         "-Xbootclasspath/a:.",
    66                         "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED",
       
    67                         "--add-exports", "jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED",
       
    68                         "--patch-module", VM_CI_MODULE + "=" + jvmciPath.toString(),
    60                         DebugOutputTest.Worker.class.getName(),
    69                         DebugOutputTest.Worker.class.getName(),
    61                         testCase.name());
    70                         testCase.name());
    62                } catch (Throwable e) {
    71                } catch (Throwable e) {
    63                 e.printStackTrace();
    72                 e.printStackTrace();
    64                 throw new Error("Problems running child process", e);
    73                 throw new Error("Problems running child process", e);