< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesCastFailureTest.java

Print this page




  23  */
  24 // this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
  25 
  26 /*
  27  * @test
  28  * @summary Run the MethodHandlesCastFailureTest.java test in dynamic CDS archive mode.
  29  * @requires vm.cds & vm.compMode != "Xcomp"
  30  * @comment Some of the tests run excessively slowly with -Xcomp. The original
  31  *          tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
  32  *          the generated tests from -Xcomp execution as well.
  33  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
  34  *          /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
  35  *          /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
  36  * @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
  37  *        ../../../../../../../lib/jdk/test/lib/Utils.java
  38  *        ../../../../../../../jdk/java/lang/invoke/MethodHandlesCastFailureTest.java
  39  *        ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
  40  *        ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
  41  *        ../test-classes/TestMHApp.java
  42  * @build sun.hotspot.WhiteBox
  43  * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  44  * @run junit/othervm/timeout=240 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesCastFailureTest
  45  */
  46 
  47 import org.junit.Test;
  48 
  49 import java.io.File;
  50 
  51 import jtreg.SkippedException;
  52 
  53 import sun.hotspot.gc.GC;
  54 
  55 public class MethodHandlesCastFailureTest extends DynamicArchiveTestBase {
  56     @Test
  57     public void test() throws Exception {
  58         runTest(MethodHandlesCastFailureTest::testImpl);
  59     }
  60 
  61     private static final String classDir = System.getProperty("test.classes");
  62     private static final String mainClass = "TestMHApp";
  63     private static final String javaClassPath = System.getProperty("java.class.path");
  64     private static final String ps = System.getProperty("path.separator");
  65     private static final String testPackageName = "test.java.lang.invoke";
  66     private static final String testClassName = "MethodHandlesCastFailureTest";
  67     private static final String skippedException = "jtreg.SkippedException: Unable to map shared archive: test did not complete";
  68 
  69     static void testImpl() throws Exception {
  70         String topArchiveName = getNewArchiveName();
  71         JarBuilder.build("MH", new File(classDir), null);
  72         String appJar = classDir + File.separator + "MH.jar";
  73 
  74         String[] classPaths = javaClassPath.split(File.pathSeparator);
  75         String junitJar = null;
  76         for (String path : classPaths) {
  77             if (path.endsWith("junit.jar")) {
  78                 junitJar = path;
  79                 break;
  80             }
  81         }
  82 
  83         dumpAndRun(topArchiveName, "-Xlog:cds,cds+dynamic=debug,class+load=trace",
  84             "-cp", appJar + ps + junitJar,
  85             mainClass, testPackageName + "." + testClassName);
  86     }
  87 }


  23  */
  24 // this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
  25 
  26 /*
  27  * @test
  28  * @summary Run the MethodHandlesCastFailureTest.java test in dynamic CDS archive mode.
  29  * @requires vm.cds & vm.compMode != "Xcomp"
  30  * @comment Some of the tests run excessively slowly with -Xcomp. The original
  31  *          tests aren't executed with -Xcomp in the CI pipeline, so let's exclude
  32  *          the generated tests from -Xcomp execution as well.
  33  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
  34  *          /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive
  35  *          /test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes
  36  * @compile ../../../../../../../jdk/java/lang/invoke/MethodHandlesTest.java
  37  *        ../../../../../../../lib/jdk/test/lib/Utils.java
  38  *        ../../../../../../../jdk/java/lang/invoke/MethodHandlesCastFailureTest.java
  39  *        ../../../../../../../jdk/java/lang/invoke/remote/RemoteExample.java
  40  *        ../../../../../../../jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
  41  *        ../test-classes/TestMHApp.java
  42  * @build sun.hotspot.WhiteBox
  43  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  44  * @run junit/othervm/timeout=240 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MethodHandlesCastFailureTest
  45  */
  46 
  47 import org.junit.Test;
  48 
  49 import java.io.File;
  50 


  51 import sun.hotspot.gc.GC;
  52 
  53 public class MethodHandlesCastFailureTest extends DynamicArchiveTestBase {
  54     @Test
  55     public void test() throws Exception {
  56         runTest(MethodHandlesCastFailureTest::testImpl);
  57     }
  58 
  59     private static final String classDir = System.getProperty("test.classes");
  60     private static final String mainClass = "TestMHApp";
  61     private static final String javaClassPath = System.getProperty("java.class.path");
  62     private static final String ps = System.getProperty("path.separator");
  63     private static final String testPackageName = "test.java.lang.invoke";
  64     private static final String testClassName = "MethodHandlesCastFailureTest";

  65 
  66     static void testImpl() throws Exception {
  67         String topArchiveName = getNewArchiveName();
  68         JarBuilder.build("MH", new File(classDir), null);
  69         String appJar = classDir + File.separator + "MH.jar";
  70 
  71         String[] classPaths = javaClassPath.split(File.pathSeparator);
  72         String junitJar = null;
  73         for (String path : classPaths) {
  74             if (path.endsWith("junit.jar")) {
  75                 junitJar = path;
  76                 break;
  77             }
  78         }
  79 
  80         dumpAndRun(topArchiveName, "-Xlog:cds,cds+dynamic=debug,class+load=trace",
  81             "-cp", appJar + ps + junitJar,
  82             mainClass, testPackageName + "." + testClassName);
  83     }
  84 }
< prev index next >