< prev index next >
test/compiler/aot/AotCompiler.java
Print this page
rev 13544 : 8187020: AOT tests should not fail if devkit dependency isn't resolved
Reviewed-by: duke
rev 13545 : [mq]: 8187020-2
*** 143,161 ****
System.err.println("Usage: " + AotCompiler.class.getName()
+ " -class <class> -libname <.so name>"
+ " [-compile <compileItems>]* [-extraopt <java option>]*");
}
public static String resolveLinker() {
Path linker = null;
// if non windows, 1st, check if PATH has ld
if (!Platform.isWindows()) {
String bin = "ld";
for (String path : System.getenv("PATH").split(File.pathSeparator)) {
! if (Files.exists(Paths.get(path).resolve(bin))) {
! // there is linker in PATH, jaotc is supposed to find it by its own
return null;
}
}
}
// there is no ld in PATH, will use ld from devkit
// artifacts are got from common/conf/jib-profiles.js
--- 143,182 ----
System.err.println("Usage: " + AotCompiler.class.getName()
+ " -class <class> -libname <.so name>"
+ " [-compile <compileItems>]* [-extraopt <java option>]*");
}
+ // runs ld -v (or ld -V on solaris) and check its exit code
+ private static boolean checkLd(Path bin) {
+ try {
+ return 0 == ProcessTools.executeCommand(bin.toString(),
+ Platform.isSolaris() ? "-V" : "-v")
+ .getExitValue();
+ } catch (Throwable t) {
+ // any errors mean ld doesn't work
+ return false;
+ }
+ }
+
public static String resolveLinker() {
Path linker = null;
// if non windows, 1st, check if PATH has ld
if (!Platform.isWindows()) {
String bin = "ld";
for (String path : System.getenv("PATH").split(File.pathSeparator)) {
! Path ld = Paths.get(path).resolve("ld");
! if (Files.exists(ld)) {
! // there is ld in PATH
! if (checkLd(ld)) {
! System.out.println("found working linker: " + ld);
! // ld works, jaotc is supposed to find and use it
return null;
+ } else {
+ System.out.println("found broken linker: " + ld);
+ // ld exists in PATH, but doesn't work, have to use devkit
+ break;
+ }
}
}
}
// there is no ld in PATH, will use ld from devkit
// artifacts are got from common/conf/jib-profiles.js
< prev index next >