8032449: Get rid of JMX in test/compiler
Reviewed-by: kvn
This commit is contained in:
parent
4f7af5c597
commit
e6b1dd586f
@ -117,15 +117,6 @@ compact3 = \
|
||||
# Tests that require compact3 API's
|
||||
#
|
||||
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/7072527/TestFullGCCount.java \
|
||||
gc/g1/TestHumongousAllocInitialMark.java \
|
||||
@ -138,11 +129,7 @@ needs_compact3 = \
|
||||
runtime/InternalApi/ThreadCpuTimesDeadlock.java \
|
||||
serviceability/threads/TestFalseDeadLock.java \
|
||||
serviceability/jvmti/GetObjectSizeOverflow.java \
|
||||
serviceability/jvmti/TestRedefineWithUnresolvedClass.java \
|
||||
compiler/tiered/NonTieredLevelsTest.java \
|
||||
compiler/tiered/TieredLevelsTest.java \
|
||||
compiler/intrinsics/bmi/verifycode \
|
||||
runtime/whitebox/WBStackSize.java
|
||||
serviceability/jvmti/TestRedefineWithUnresolvedClass.java
|
||||
|
||||
# Compact 2 adds full VM tests
|
||||
compact2 = \
|
||||
|
@ -25,8 +25,8 @@ import java.util.function.IntPredicate;
|
||||
|
||||
/**
|
||||
* @test NonTieredLevelsTest
|
||||
* @ignore 8046268
|
||||
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
|
||||
* @ignore 8046268
|
||||
* @build NonTieredLevelsTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
/**
|
||||
* @test TieredLevelsTest
|
||||
* @ignore 8046268
|
||||
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
|
||||
* @ignore 8046268
|
||||
* @build TieredLevelsTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,9 +25,9 @@ import java.util.function.Function;
|
||||
|
||||
/*
|
||||
* @test ClearMethodStateTest
|
||||
* @ignore 8046268
|
||||
* @bug 8006683 8007288 8022832
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @ignore 8046268
|
||||
* @build ClearMethodStateTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* ClearMethodStateTest
|
||||
|
@ -21,11 +21,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import com.sun.management.HotSpotDiagnosticMXBean;
|
||||
import com.sun.management.VMOption;
|
||||
import sun.hotspot.WhiteBox;
|
||||
import sun.hotspot.code.NMethod;
|
||||
import sun.management.ManagementFactoryHelper;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Executable;
|
||||
@ -98,15 +95,7 @@ public abstract class CompilerWhiteBoxTest {
|
||||
*/
|
||||
protected static String getVMOption(String name) {
|
||||
Objects.requireNonNull(name);
|
||||
HotSpotDiagnosticMXBean diagnostic
|
||||
= ManagementFactoryHelper.getDiagnosticMXBean();
|
||||
VMOption tmp;
|
||||
try {
|
||||
tmp = diagnostic.getVMOption(name);
|
||||
} catch (IllegalArgumentException e) {
|
||||
tmp = null;
|
||||
}
|
||||
return (tmp == null ? null : tmp.getValue());
|
||||
return Objects.toString(WHITE_BOX.getVMFlag(name), null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -174,7 +163,7 @@ public abstract class CompilerWhiteBoxTest {
|
||||
* @see #test()
|
||||
*/
|
||||
protected final void runTest() {
|
||||
if (ManagementFactoryHelper.getCompilationMXBean() == null) {
|
||||
if (CompilerWhiteBoxTest.MODE.startsWith("interpreted ")) {
|
||||
System.err.println(
|
||||
"Warning: test is not applicable in interpreted mode");
|
||||
return;
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test DeoptimizeAllTest
|
||||
* @ignore 8046268
|
||||
* @bug 8006683 8007288 8022832
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @ignore 8046268
|
||||
* @build DeoptimizeAllTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeAllTest
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test DeoptimizeMethodTest
|
||||
* @ignore 8046268
|
||||
* @bug 8006683 8007288 8022832
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @ignore 8046268
|
||||
* @build DeoptimizeMethodTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeMethodTest
|
||||
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,9 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test EnqueueMethodForCompilationTest
|
||||
* @ignore 8046268
|
||||
* @bug 8006683 8007288 8022832
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @ignore 8046268
|
||||
* @build EnqueueMethodForCompilationTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* EnqueueMethodForCompilationTest
|
||||
|
@ -26,9 +26,9 @@ import sun.hotspot.code.NMethod;
|
||||
|
||||
/*
|
||||
* @test GetNMethodTest
|
||||
* @ignore 8046268
|
||||
* @bug 8038240
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @ignore 8046268
|
||||
* @build GetNMethodTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* GetNMethodTest
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test MakeMethodNotCompilableTest
|
||||
* @ignore 8046268
|
||||
* @bug 8012322 8006683 8007288 8022832
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @ignore 8046268
|
||||
* @build MakeMethodNotCompilableTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* MakeMethodNotCompilableTest
|
||||
|
@ -39,7 +39,6 @@
|
||||
* Please file a test bug, if this is a problem.
|
||||
*/
|
||||
|
||||
import com.sun.management.HotSpotDiagnosticMXBean;
|
||||
import sun.hotspot.WhiteBox;
|
||||
|
||||
public class WBStackSize {
|
||||
@ -81,8 +80,7 @@ public class WBStackSize {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
HotSpotDiagnosticMXBean bean = sun.management.ManagementFactoryHelper.getDiagnosticMXBean();
|
||||
long configStackSize = Long.valueOf(bean.getVMOption("ThreadStackSize").getValue()) * K;
|
||||
long configStackSize = wb.getIntxVMFlag("ThreadStackSize") * K;
|
||||
|
||||
System.out.println("ThreadStackSize VM option: " + configStackSize);
|
||||
|
||||
|
@ -25,6 +25,10 @@
|
||||
package sun.hotspot;
|
||||
|
||||
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 sun.hotspot.parser.DiagnosticCommand;
|
||||
|
||||
@ -171,4 +175,15 @@ public class WhiteBox {
|
||||
public native Long getUint64VMFlag(String name);
|
||||
public native String getStringVMFlag(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);
|
||||
}
|
||||
}
|
||||
|
@ -91,16 +91,20 @@ public final class VmFlagTest<T> {
|
||||
}
|
||||
|
||||
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);
|
||||
String newValue = getVMOptionAsString();
|
||||
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) {
|
||||
String oldValue = getVMOptionAsString();
|
||||
Asserts.assertEQ(oldValue, asString(getValue()));
|
||||
Asserts.assertEQ(oldValue, asString(WHITE_BOX.getVMFlag(flagName)));
|
||||
setNewValue(value);
|
||||
String newValue = getVMOptionAsString();
|
||||
Asserts.assertEQ(oldValue, newValue);
|
||||
|
Loading…
Reference in New Issue
Block a user