< prev index next >

test/jdk/java/foreign/TestUpcallException.java

Print this page
*** 31,13 ***
   * @run testng/othervm/native
   *   --enable-native-access=ALL-UNNAMED
   *   TestUpcallException
   */
  
- import jdk.incubator.foreign.CLinker;
- import jdk.incubator.foreign.FunctionDescriptor;
- import jdk.incubator.foreign.ResourceScope;
  import jdk.test.lib.Utils;
  import org.testng.annotations.Test;
  
  import java.io.BufferedReader;
  import java.io.IOException;
--- 31,10 ---

*** 52,21 ***
  
  public class TestUpcallException {
  
      @Test
      public void testExceptionInterpreted() throws InterruptedException, IOException {
!         boolean useSpec = false;
!         run(useSpec);
      }
  
      @Test
      public void testExceptionSpecialized() throws IOException, InterruptedException {
!         boolean useSpec = true;
!         run(useSpec);
      }
  
!     private void run(boolean useSpec) throws IOException, InterruptedException {
          Process process = new ProcessBuilder()
              .command(
                  Paths.get(Utils.TEST_JDK)
                       .resolve("bin")
                       .resolve("java")
--- 49,21 ---
  
  public class TestUpcallException {
  
      @Test
      public void testExceptionInterpreted() throws InterruptedException, IOException {
!         run(/* useSpec = */ false, /* isVoid = */ true);
!         run(/* useSpec = */ false, /* isVoid = */ false);
      }
  
      @Test
      public void testExceptionSpecialized() throws IOException, InterruptedException {
!         run(/* useSpec = */ true, /* isVoid = */ true);
!         run(/* useSpec = */ true, /* isVoid = */ false);
      }
  
!     private void run(boolean useSpec, boolean isVoid) throws IOException, InterruptedException {
          Process process = new ProcessBuilder()
              .command(
                  Paths.get(Utils.TEST_JDK)
                       .resolve("bin")
                       .resolve("java")

*** 75,11 ***
                  "--add-modules", "jdk.incubator.foreign",
                  "--enable-native-access=ALL-UNNAMED",
                  "-Djava.library.path=" + System.getProperty("java.library.path"),
                  "-Djdk.internal.foreign.ProgrammableUpcallHandler.USE_SPEC=" + useSpec,
                  "-cp", Utils.TEST_CLASS_PATH,
!                 "ThrowingUpcall")
              .start();
  
          int result = process.waitFor();
          assertNotEquals(result, 0);
  
--- 72,12 ---
                  "--add-modules", "jdk.incubator.foreign",
                  "--enable-native-access=ALL-UNNAMED",
                  "-Djava.library.path=" + System.getProperty("java.library.path"),
                  "-Djdk.internal.foreign.ProgrammableUpcallHandler.USE_SPEC=" + useSpec,
                  "-cp", Utils.TEST_CLASS_PATH,
!                 "ThrowingUpcall",
+                 isVoid ? "void" : "non-void")
              .start();
  
          int result = process.waitFor();
          assertNotEquals(result, 0);
  
< prev index next >