# HG changeset patch # User iignatyev # Date 1573162771 28800 # Node ID 2b0f2fe82735415ce06ac0da7af77e39d1ae84ce # Parent 291775bcf35da7646eb2d72db0eb7fc2a78bc404 8230364: [JVMCI] a number of JVMCI tests are not jtreg enabled Reviewed-by: kvn diff -r 291775bcf35d -r 2b0f2fe82735 test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotJVMCIRuntime.java --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotJVMCIRuntime.java Thu Nov 07 16:22:22 2019 -0500 +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotJVMCIRuntime.java Thu Nov 07 13:39:31 2019 -0800 @@ -20,6 +20,22 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* + * @test + * @requires vm.jvmci + * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot + * jdk.internal.vm.ci/jdk.vm.ci.runtime + * jdk.internal.vm.ci/jdk.vm.ci.meta + * jdk.internal.vm.ci/jdk.vm.ci.code + * jdk.internal.vm.ci/jdk.vm.ci.common + * @library /compiler/jvmci/jdk.vm.ci.hotspot.test/src + * /compiler/jvmci/jdk.vm.ci.code.test/src + * @run testng/othervm + * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler + * jdk.vm.ci.hotspot.test.TestHotSpotJVMCIRuntime + */ + package jdk.vm.ci.hotspot.test; import java.util.ArrayList; @@ -27,8 +43,8 @@ import java.util.List; import java.util.function.Predicate; -import org.junit.Assert; -import org.junit.Test; +import org.testng.Assert; +import org.testng.annotations.Test; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.meta.MetaAccessProvider; @@ -74,7 +90,7 @@ if (expect instanceof Integer) { Assert.fail("expected " + expect + ", got " + e + " for bytes == " + Arrays.toString(bytes)); } else { - Assert.assertTrue(e.toString(), ((Class) expect).isInstance(e)); + Assert.assertTrue(((Class) expect).isInstance(e), e.toString()); } } } @@ -98,20 +114,12 @@ // Extension classes not available } ClassLoader jvmciLoader = HotSpotJVMCIRuntime.class.getClassLoader(); - ClassLoader extLoader = getExtensionLoader(); + ClassLoader platformLoader = ClassLoader.getPlatformClassLoader(); for (Class c : classes) { ClassLoader cl = c.getClassLoader(); - boolean expected = cl == null || cl == jvmciLoader || cl == extLoader; + boolean expected = cl == null || cl == jvmciLoader || cl == platformLoader; boolean actual = predicate.test(metaAccess.lookupJavaType(c)); - Assert.assertEquals(c + ": cl=" + cl, expected, actual); + Assert.assertEquals(expected, actual, c + ": cl=" + cl); } } - - private static ClassLoader getExtensionLoader() throws Exception { - Object launcher = Class.forName("sun.misc.Launcher").getMethod("getLauncher").invoke(null); - ClassLoader appLoader = (ClassLoader) launcher.getClass().getMethod("getClassLoader").invoke(launcher); - ClassLoader extLoader = appLoader.getParent(); - assert extLoader.getClass().getName().equals("sun.misc.Launcher$ExtClassLoader") : extLoader; - return extLoader; - } } diff -r 291775bcf35d -r 2b0f2fe82735 test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotSpeculationLog.java --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotSpeculationLog.java Thu Nov 07 16:22:22 2019 -0500 +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotSpeculationLog.java Thu Nov 07 13:39:31 2019 -0800 @@ -20,13 +20,25 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* + * @test + * @requires vm.jvmci + * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot + * jdk.internal.vm.ci/jdk.vm.ci.meta + * @library /compiler/jvmci/jdk.vm.ci.hotspot.test/src + * @run testng/othervm + * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler + * jdk.vm.ci.hotspot.test.TestHotSpotSpeculationLog + */ + package jdk.vm.ci.hotspot.test; import java.util.function.Supplier; -import org.junit.Assert; -import org.junit.Assume; -import org.junit.Test; +import org.testng.Assert; +import org.testng.SkipException; +import org.testng.annotations.Test; import jdk.vm.ci.hotspot.HotSpotSpeculationLog; import jdk.vm.ci.meta.SpeculationLog; @@ -87,16 +99,20 @@ SpeculationLog.Speculation s2 = log.speculate(reason2); boolean added = log.addFailedSpeculation(s1); - Assume.assumeTrue(added); + if (!added) { + throw new SkipException("log.addFailedSpeculation(s1) is false"); + } + log.collectFailedSpeculations(); Assert.assertFalse(log.maySpeculate(reason1)); Assert.assertTrue(log.maySpeculate(reason2)); added = log.addFailedSpeculation(s2); - Assume.assumeTrue(added); + if (!added) { + throw new SkipException("log.addFailedSpeculation(s2) is false"); + } log.collectFailedSpeculations(); - Assume.assumeTrue(added); Assert.assertFalse(log.maySpeculate(reason1)); - Assert.assertFalse(log.toString(), log.maySpeculate(reason2)); + Assert.assertFalse(log.maySpeculate(reason2), log.toString()); } } diff -r 291775bcf35d -r 2b0f2fe82735 test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestServices.java --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestServices.java Thu Nov 07 16:22:22 2019 -0500 +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestServices.java Thu Nov 07 13:39:31 2019 -0800 @@ -20,6 +20,17 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* + * @test + * @requires vm.jvmci + * @modules jdk.internal.vm.ci/jdk.vm.ci.services:+open + * @library /compiler/jvmci/jdk.vm.ci.hotspot.test/src + * @run testng/othervm + * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler + * jdk.vm.ci.hotspot.test.TestServices + */ + package jdk.vm.ci.hotspot.test; import java.lang.reflect.Field; @@ -27,8 +38,8 @@ import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Test; +import org.testng.Assert; +import org.testng.annotations.Test; import jdk.vm.ci.services.Services; diff -r 291775bcf35d -r 2b0f2fe82735 test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestTranslatedException.java --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestTranslatedException.java Thu Nov 07 16:22:22 2019 -0500 +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestTranslatedException.java Thu Nov 07 13:39:31 2019 -0800 @@ -20,6 +20,18 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* + * @test + * @requires vm.jvmci + * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot:open + * @library /compiler/jvmci/jdk.vm.ci.hotspot.test/src + * @ignore 8233745 + * @run testng/othervm + * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler + * jdk.vm.ci.hotspot.test.TestTranslatedException + */ + package jdk.vm.ci.hotspot.test; import java.io.ByteArrayOutputStream; @@ -27,8 +39,8 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.junit.Assert; -import org.junit.Test; +import org.testng.Assert; +import org.testng.annotations.Test; public class TestTranslatedException { @@ -71,6 +83,6 @@ "jdk.vm.ci.hotspot.TranslatedException: [java.lang.ClassNotFoundException: jdk/vm/ci/hotspot/test/TestTranslatedException$Untranslatable]", "jdk.vm.ci.hotspot.test.TestTranslatedException$Untranslatable: test exception"); - Assert.assertEquals("before:\n" + before + "\nafter:\n" + after, before, after); + Assert.assertEquals(before, after); } } diff -r 291775bcf35d -r 2b0f2fe82735 test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/VirtualObjectLayoutTest.java --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/VirtualObjectLayoutTest.java Thu Nov 07 16:22:22 2019 -0500 +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/VirtualObjectLayoutTest.java Thu Nov 07 13:39:31 2019 -0800 @@ -20,10 +20,26 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* + * @test + * @requires vm.jvmci + * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot + * jdk.internal.vm.ci/jdk.vm.ci.runtime + * jdk.internal.vm.ci/jdk.vm.ci.meta + * jdk.internal.vm.ci/jdk.vm.ci.code + * jdk.internal.vm.ci/jdk.vm.ci.common + * @library /compiler/jvmci/jdk.vm.ci.hotspot.test/src + * /compiler/jvmci/jdk.vm.ci.code.test/src + * @run testng/othervm + * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler + * jdk.vm.ci.hotspot.test.VirtualObjectLayoutTest + */ + package jdk.vm.ci.hotspot.test; -import org.junit.Assert; -import org.junit.Test; +import org.testng.Assert; +import org.testng.annotations.Test; import jdk.vm.ci.code.VirtualObject; import jdk.vm.ci.code.test.VirtualObjectTestBase; @@ -43,10 +59,10 @@ try { HotSpotCompiledCode.verifyVirtualObject(virtual); } catch (JVMCIError e) { - Assert.assertTrue("Unexpected error verifying " + virtual, error); + Assert.assertTrue(error, "Unexpected error verifying " + virtual); return; } - Assert.assertFalse("Expected error but passed verifying " + virtual, error); + Assert.assertFalse(error, "Expected error but passed verifying " + virtual); } @Test