< prev index next >

test/jdk/com/sun/tools/jextract/jclang-ffi/TestJextractFFI.java

Print this page




  93         launch(command);
  94     }
  95 
  96     public void buildJclang() throws IOException, InterruptedException {
  97         List<String> command = new ArrayList<>(List.of(
  98                 javac_cmd,
  99                 "--module-path", CLANG_JAR,
 100                 "-d", JCLANG_PATH));
 101         Files.walk(jclang_src_path)
 102                 .map(path -> path.toString())
 103                 .filter(filename -> filename.endsWith(".java"))
 104                 .forEach(command::add);
 105         launch(command);
 106     }
 107 
 108     public void jextractFFI() throws IOException, InterruptedException {
 109         List<String> command = List.of(jextract_cmd,
 110                 "-I", clang_header_path.toString(),
 111                 "-t", "clang",
 112                 "-d", CLANG_FFI_PATH,

 113                 "-J-Dlibclang.debug=true",
 114                 "-J-Djava.library.path=" + clang_lib_path.toString(),
 115                 "-J--module-path", "-J" + CLANG_JAR,
 116                 "-J--upgrade-module-path", "-J" + JCLANG_PATH,
 117                 clang_header_path
 118                         .resolve("clang-c").resolve("Index.h").toString());
 119         File err = launch(command);
 120         if (! Files.lines(err.toPath())
 121                 .anyMatch(s -> s.contains("FFI"))) {
 122             throw new Error("Not running jextract on FFI stack");
 123         }
 124     }
 125 
 126     public void compareResult() throws IOException {
 127         // We cannot do jar file byte-to-byte comparison because
 128         // jar file format include timestamp regarding modification,
 129         // thus such comparison will fail.
 130         Path[] jni = Files.walk(getClassPath(CLANG_JNI_PATH))
 131                 .sorted().toArray(Path[]::new);
 132         Path[] ffi = Files.walk(getClassPath(CLANG_FFI_PATH))




  93         launch(command);
  94     }
  95 
  96     public void buildJclang() throws IOException, InterruptedException {
  97         List<String> command = new ArrayList<>(List.of(
  98                 javac_cmd,
  99                 "--module-path", CLANG_JAR,
 100                 "-d", JCLANG_PATH));
 101         Files.walk(jclang_src_path)
 102                 .map(path -> path.toString())
 103                 .filter(filename -> filename.endsWith(".java"))
 104                 .forEach(command::add);
 105         launch(command);
 106     }
 107 
 108     public void jextractFFI() throws IOException, InterruptedException {
 109         List<String> command = List.of(jextract_cmd,
 110                 "-I", clang_header_path.toString(),
 111                 "-t", "clang",
 112                 "-d", CLANG_FFI_PATH,
 113                 "-J-Djextract.debug=true",
 114                 "-J-Dlibclang.debug=true",
 115                 "-J-Djava.library.path=" + clang_lib_path.toString(),
 116                 "-J--module-path", "-J" + CLANG_JAR,
 117                 "-J--upgrade-module-path", "-J" + JCLANG_PATH,
 118                 clang_header_path
 119                         .resolve("clang-c").resolve("Index.h").toString());
 120         File err = launch(command);
 121         if (! Files.lines(err.toPath())
 122                 .anyMatch(s -> s.contains("FFI"))) {
 123             throw new Error("Not running jextract on FFI stack");
 124         }
 125     }
 126 
 127     public void compareResult() throws IOException {
 128         // We cannot do jar file byte-to-byte comparison because
 129         // jar file format include timestamp regarding modification,
 130         // thus such comparison will fail.
 131         Path[] jni = Files.walk(getClassPath(CLANG_JNI_PATH))
 132                 .sorted().toArray(Path[]::new);
 133         Path[] ffi = Files.walk(getClassPath(CLANG_FFI_PATH))


< prev index next >