8032449: Get rid of JMX in test/compiler

Reviewed-by: kvn
This commit is contained in:
Igor Ignatyev 2014-07-19 00:34:20 +04:00
parent 4f7af5c597
commit e6b1dd586f
13 changed files with 35 additions and 42 deletions

View File

@ -117,15 +117,6 @@ compact3 = \
# Tests that require compact3 API's # Tests that require compact3 API's
# #
needs_compact3 = \ needs_compact3 = \
compiler/8009761/Test8009761.java \
compiler/whitebox/DeoptimizeMethodTest.java \
compiler/whitebox/SetForceInlineMethodTest.java \
compiler/whitebox/SetDontInlineMethodTest.java \
compiler/whitebox/DeoptimizeAllTest.java \
compiler/whitebox/MakeMethodNotCompilableTest.java \
compiler/whitebox/ClearMethodStateTest.java \
compiler/whitebox/EnqueueMethodForCompilationTest.java \
compiler/whitebox/IsMethodCompilableTest.java \
gc/6581734/Test6581734.java \ gc/6581734/Test6581734.java \
gc/7072527/TestFullGCCount.java \ gc/7072527/TestFullGCCount.java \
gc/g1/TestHumongousAllocInitialMark.java \ gc/g1/TestHumongousAllocInitialMark.java \
@ -138,11 +129,7 @@ needs_compact3 = \
runtime/InternalApi/ThreadCpuTimesDeadlock.java \ runtime/InternalApi/ThreadCpuTimesDeadlock.java \
serviceability/threads/TestFalseDeadLock.java \ serviceability/threads/TestFalseDeadLock.java \
serviceability/jvmti/GetObjectSizeOverflow.java \ serviceability/jvmti/GetObjectSizeOverflow.java \
serviceability/jvmti/TestRedefineWithUnresolvedClass.java \ serviceability/jvmti/TestRedefineWithUnresolvedClass.java
compiler/tiered/NonTieredLevelsTest.java \
compiler/tiered/TieredLevelsTest.java \
compiler/intrinsics/bmi/verifycode \
runtime/whitebox/WBStackSize.java
# Compact 2 adds full VM tests # Compact 2 adds full VM tests
compact2 = \ compact2 = \

View File

@ -25,8 +25,8 @@ import java.util.function.IntPredicate;
/** /**
* @test NonTieredLevelsTest * @test NonTieredLevelsTest
* @ignore 8046268
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @ignore 8046268
* @build NonTieredLevelsTest * @build NonTieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation * @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation

View File

@ -23,8 +23,8 @@
/** /**
* @test TieredLevelsTest * @test TieredLevelsTest
* @ignore 8046268
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @ignore 8046268
* @build TieredLevelsTest * @build TieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,9 @@ import java.util.function.Function;
/* /*
* @test ClearMethodStateTest * @test ClearMethodStateTest
* @ignore 8046268
* @bug 8006683 8007288 8022832 * @bug 8006683 8007288 8022832
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @ignore 8046268
* @build ClearMethodStateTest * @build ClearMethodStateTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* ClearMethodStateTest * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* ClearMethodStateTest

View File

@ -21,11 +21,8 @@
* questions. * questions.
*/ */
import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.VMOption;
import sun.hotspot.WhiteBox; import sun.hotspot.WhiteBox;
import sun.hotspot.code.NMethod; import sun.hotspot.code.NMethod;
import sun.management.ManagementFactoryHelper;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Executable; import java.lang.reflect.Executable;
@ -98,15 +95,7 @@ public abstract class CompilerWhiteBoxTest {
*/ */
protected static String getVMOption(String name) { protected static String getVMOption(String name) {
Objects.requireNonNull(name); Objects.requireNonNull(name);
HotSpotDiagnosticMXBean diagnostic return Objects.toString(WHITE_BOX.getVMFlag(name), null);
= ManagementFactoryHelper.getDiagnosticMXBean();
VMOption tmp;
try {
tmp = diagnostic.getVMOption(name);
} catch (IllegalArgumentException e) {
tmp = null;
}
return (tmp == null ? null : tmp.getValue());
} }
/** /**
@ -174,7 +163,7 @@ public abstract class CompilerWhiteBoxTest {
* @see #test() * @see #test()
*/ */
protected final void runTest() { protected final void runTest() {
if (ManagementFactoryHelper.getCompilationMXBean() == null) { if (CompilerWhiteBoxTest.MODE.startsWith("interpreted ")) {
System.err.println( System.err.println(
"Warning: test is not applicable in interpreted mode"); "Warning: test is not applicable in interpreted mode");
return; return;

View File

@ -23,9 +23,9 @@
/* /*
* @test DeoptimizeAllTest * @test DeoptimizeAllTest
* @ignore 8046268
* @bug 8006683 8007288 8022832 * @bug 8006683 8007288 8022832
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @ignore 8046268
* @build DeoptimizeAllTest * @build DeoptimizeAllTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeAllTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeAllTest

View File

@ -23,9 +23,9 @@
/* /*
* @test DeoptimizeMethodTest * @test DeoptimizeMethodTest
* @ignore 8046268
* @bug 8006683 8007288 8022832 * @bug 8006683 8007288 8022832
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @ignore 8046268
* @build DeoptimizeMethodTest * @build DeoptimizeMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeMethodTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeMethodTest

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,9 +23,9 @@
/* /*
* @test EnqueueMethodForCompilationTest * @test EnqueueMethodForCompilationTest
* @ignore 8046268
* @bug 8006683 8007288 8022832 * @bug 8006683 8007288 8022832
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @ignore 8046268
* @build EnqueueMethodForCompilationTest * @build EnqueueMethodForCompilationTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* EnqueueMethodForCompilationTest * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* EnqueueMethodForCompilationTest

View File

@ -26,9 +26,9 @@ import sun.hotspot.code.NMethod;
/* /*
* @test GetNMethodTest * @test GetNMethodTest
* @ignore 8046268
* @bug 8038240 * @bug 8038240
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @ignore 8046268
* @build GetNMethodTest * @build GetNMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* GetNMethodTest * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* GetNMethodTest

View File

@ -23,9 +23,9 @@
/* /*
* @test MakeMethodNotCompilableTest * @test MakeMethodNotCompilableTest
* @ignore 8046268
* @bug 8012322 8006683 8007288 8022832 * @bug 8012322 8006683 8007288 8022832
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @ignore 8046268
* @build MakeMethodNotCompilableTest * @build MakeMethodNotCompilableTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* MakeMethodNotCompilableTest * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* MakeMethodNotCompilableTest

View File

@ -39,7 +39,6 @@
* Please file a test bug, if this is a problem. * Please file a test bug, if this is a problem.
*/ */
import com.sun.management.HotSpotDiagnosticMXBean;
import sun.hotspot.WhiteBox; import sun.hotspot.WhiteBox;
public class WBStackSize { public class WBStackSize {
@ -81,8 +80,7 @@ public class WBStackSize {
} }
public static void main(String[] args) { public static void main(String[] args) {
HotSpotDiagnosticMXBean bean = sun.management.ManagementFactoryHelper.getDiagnosticMXBean(); long configStackSize = wb.getIntxVMFlag("ThreadStackSize") * K;
long configStackSize = Long.valueOf(bean.getVMOption("ThreadStackSize").getValue()) * K;
System.out.println("ThreadStackSize VM option: " + configStackSize); System.out.println("ThreadStackSize VM option: " + configStackSize);

View File

@ -25,6 +25,10 @@
package sun.hotspot; package sun.hotspot;
import java.lang.reflect.Executable; import java.lang.reflect.Executable;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;
import java.security.BasicPermission; import java.security.BasicPermission;
import sun.hotspot.parser.DiagnosticCommand; import sun.hotspot.parser.DiagnosticCommand;
@ -171,4 +175,15 @@ public class WhiteBox {
public native Long getUint64VMFlag(String name); public native Long getUint64VMFlag(String name);
public native String getStringVMFlag(String name); public native String getStringVMFlag(String name);
public native Double getDoubleVMFlag(String name); public native Double getDoubleVMFlag(String name);
private final List<Function<String,Object>> flagsGetters = Arrays.asList(
this::getBooleanVMFlag, this::getIntxVMFlag, this::getUintxVMFlag,
this::getUint64VMFlag, this::getStringVMFlag, this::getDoubleVMFlag);
public Object getVMFlag(String name) {
return flagsGetters.stream()
.map(f -> f.apply(name))
.filter(x -> x != null)
.findAny()
.orElse(null);
}
} }

View File

@ -91,16 +91,20 @@ public final class VmFlagTest<T> {
} }
private void testPositive(T value, T expected) { private void testPositive(T value, T expected) {
Asserts.assertEQ(getVMOptionAsString(), asString(getValue())); String oldValue = getVMOptionAsString();
Asserts.assertEQ(oldValue, asString(getValue()));
Asserts.assertEQ(oldValue, asString(WHITE_BOX.getVMFlag(flagName)));
setNewValue(value); setNewValue(value);
String newValue = getVMOptionAsString(); String newValue = getVMOptionAsString();
Asserts.assertEQ(newValue, asString(expected)); Asserts.assertEQ(newValue, asString(expected));
Asserts.assertEQ(getVMOptionAsString(), asString(getValue())); Asserts.assertEQ(newValue, asString(getValue()));
Asserts.assertEQ(newValue, asString(WHITE_BOX.getVMFlag(flagName)));
} }
private void testNegative(T value, T expected) { private void testNegative(T value, T expected) {
String oldValue = getVMOptionAsString(); String oldValue = getVMOptionAsString();
Asserts.assertEQ(oldValue, asString(getValue())); Asserts.assertEQ(oldValue, asString(getValue()));
Asserts.assertEQ(oldValue, asString(WHITE_BOX.getVMFlag(flagName)));
setNewValue(value); setNewValue(value);
String newValue = getVMOptionAsString(); String newValue = getVMOptionAsString();
Asserts.assertEQ(oldValue, newValue); Asserts.assertEQ(oldValue, newValue);