< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/TimerKeyTest.java

Print this page
rev 52509 : [mq]: graal2

*** 37,57 **** --- 37,69 ---- import org.graalvm.compiler.debug.TimerKey; import org.graalvm.compiler.options.OptionKey; import org.graalvm.compiler.options.OptionValues; import org.graalvm.compiler.serviceprovider.GraalServices; import org.junit.Assume; + import org.junit.AssumptionViolatedException; import org.junit.Before; import org.junit.Test; @SuppressWarnings("try") public class TimerKeyTest { @Before public void checkCapabilities() { + assumeManagementLibraryIsLoadable(); Assume.assumeTrue("skipping management interface test", GraalServices.isCurrentThreadCpuTimeSupported()); } + /** @see <a href="https://bugs.openjdk.java.net/browse/JDK-8076557">JDK-8076557</a> */ + static void assumeManagementLibraryIsLoadable() { + try { + /* Trigger loading of the management library using the bootstrap class loader. */ + GraalServices.getCurrentThreadAllocatedBytes(); + } catch (UnsatisfiedLinkError | NoClassDefFoundError | UnsupportedOperationException e) { + throw new AssumptionViolatedException("Management interface is unavailable: " + e); + } + } + /** * Actively spins the current thread for at least a given number of milliseconds in such a way * that timers for the current thread keep ticking over. * * @return the number of milliseconds actually spent spinning which is guaranteed to be >=
< prev index next >