# HG changeset patch # User iignatyev # Date 1504304934 25200 # Fri Sep 01 15:28:54 2017 -0700 # Node ID 0f2fdbbf0e2e5b403fbed0934f658826c0967976 # Parent 046eab27258f08f7d0b793f42bb9dc31938d08d5 8187020: AOT tests should not fail if devkit dependency isn't resolved Reviewed-by: duke diff --git a/test/compiler/aot/AotCompiler.java b/test/compiler/aot/AotCompiler.java --- a/test/compiler/aot/AotCompiler.java +++ b/test/compiler/aot/AotCompiler.java @@ -147,11 +147,14 @@ public static String resolveLinker() { Path linker = null; - // 1st, check if PATH has ld - for (String path : System.getenv("PATH").split(File.pathSeparator)) { - if (Files.exists(Paths.get(path).resolve("ld"))) { - // there is ld in PATH, jaotc is supposed to find it by its own - return 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 @@ -275,7 +278,9 @@ } } } catch (FileNotFoundException e) { - throw new Error("artifact resolution error: " + e, e); + System.err.println("artifact resolution error: " + e); + // let jaotc try to find linker + return null; } if (linker != null) { return linker.toAbsolutePath().toString(); # HG changeset patch # User iignatyev # Date 1504335498 25200 # Fri Sep 01 23:58:18 2017 -0700 # Node ID 33f6a837da32dcb73ce30e6da9fd73d104dc39e7 # Parent 0f2fdbbf0e2e5b403fbed0934f658826c0967976 [mq]: 8187020-2 diff --git a/test/compiler/aot/AotCompiler.java b/test/compiler/aot/AotCompiler.java --- a/test/compiler/aot/AotCompiler.java +++ b/test/compiler/aot/AotCompiler.java @@ -145,17 +145,38 @@ + " [-compile ]* [-extraopt ]*"); } + // 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)) { - if (Files.exists(Paths.get(path).resolve(bin))) { - // there is linker in PATH, jaotc is supposed to find it by its own - return null; - } - } + 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