changeset 13533:8c39c9157c17

8183337: hotspot/compiler/aot tests fail due to missed tools Reviewed-by: kvn
author iignatyev
date Fri, 18 Aug 2017 14:54:43 -0700
parents c8607c55bfda
children ac5a73f93b55
files test/ProblemList.txt test/compiler/aot/AotCompiler.java test/compiler/aot/TEST.properties test/compiler/aot/cli/jaotc/JaotcTestHelper.java
diffstat 4 files changed, 165 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/test/ProblemList.txt	Fri Aug 18 18:39:37 2017 +0200
+++ b/test/ProblemList.txt	Fri Aug 18 14:54:43 2017 -0700
@@ -54,68 +54,6 @@
 # aot test intermittently failing in jprt 8175791
 compiler/aot/DeoptimizationTest.java 8175791 windows-all
 
-# aot missing tools (linker) on OS-X and Windows 8183337
-compiler/aot/calls/fromAot/AotInvokeDynamic2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeDynamic2CompiledTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeDynamic2InterpretedTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeDynamic2NativeTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeInterface2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeInterface2CompiledTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeInterface2InterpretedTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeInterface2NativeTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeSpecial2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeSpecial2CompiledTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeSpecial2InterpretedTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeSpecial2NativeTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeStatic2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeStatic2CompiledTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeStatic2InterpretedTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeStatic2NativeTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeVirtual2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeVirtual2CompiledTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeVirtual2InterpretedTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromAot/AotInvokeVirtual2NativeTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromCompiled/CompiledInvokeDynamic2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromCompiled/CompiledInvokeInterface2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromCompiled/CompiledInvokeSpecial2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromCompiled/CompiledInvokeStatic2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromCompiled/CompiledInvokeVirtual2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromInterpreted/InterpretedInvokeDynamic2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromInterpreted/InterpretedInvokeInterface2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromInterpreted/InterpretedInvokeSpecial2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromInterpreted/InterpretedInvokeStatic2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromInterpreted/InterpretedInvokeVirtual2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromNative/NativeInvokeSpecial2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromNative/NativeInvokeStatic2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/calls/fromNative/NativeInvokeVirtual2AotTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/DisabledAOTWithLibraryTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/IncorrectAOTLibraryTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/jaotc/ClasspathOptionUnknownClassTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/jaotc/CompileClassTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/jaotc/CompileDirectoryTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/jaotc/CompileJarTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/jaotc/CompileModuleTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/jaotc/ListOptionNotExistingTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/jaotc/ListOptionTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/jaotc/ListOptionWrongFileTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/MultipleAOTLibraryTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/NonExistingAOTLibraryTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/SingleAOTLibraryTest.java 8183337 windows-all,macosx-all
-compiler/aot/cli/SingleAOTOptionTest.java 8183337 windows-all,macosx-all
-compiler/aot/DeoptimizationTest.java 8183337 windows-all,macosx-all
-compiler/aot/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/collect/ClassSearchTest.java 8183337 windows-all,macosx-all
-compiler/aot/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/collect/ClassSourceTest.java 8183337 windows-all,macosx-all
-compiler/aot/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/collect/directory/DirectorySourceProviderTest.java 8183337 windows-all,macosx-all
-compiler/aot/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/collect/jar/JarSourceProviderTest.java 8183337 windows-all,macosx-all
-compiler/aot/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/collect/module/ModuleSourceProviderTest.java 8183337 windows-all,macosx-all
-compiler/aot/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/collect/SearchPathTest.java 8183337 windows-all,macosx-all
-compiler/aot/jdk.tools.jaotc.test/src/jdk/tools/jaotc/test/NativeOrderOutputStreamTest.java 8183337 windows-all,macosx-all
-compiler/aot/RecompilationTest.java 8183337 windows-all,macosx-all
-compiler/aot/SharedUsageTest.java 8183337 windows-all,macosx-all
-compiler/aot/verification/ClassAndLibraryNotMatchTest.java 8183337 windows-all,macosx-all
-compiler/aot/verification/vmflags/NotTrackedFlagTest.java 8183337 windows-all,macosx-all
-compiler/aot/verification/vmflags/TrackedFlagTest.java 8183337 windows-all,macosx-all
-
 #############################################################################
 
 # :hotspot_gc
--- a/test/compiler/aot/AotCompiler.java	Fri Aug 18 18:39:37 2017 +0200
+++ b/test/compiler/aot/AotCompiler.java	Fri Aug 18 14:54:43 2017 -0700
@@ -23,9 +23,14 @@
 
 package compiler.aot;
 
+import jdk.test.lib.Platform;
+import jdk.test.lib.artifacts.Artifact;
+import jdk.test.lib.artifacts.ArtifactResolver;
 import jdk.test.lib.process.OutputAnalyzer;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.lang.annotation.Annotation;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -35,6 +40,7 @@
 import java.util.List;
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
 
 /**
  * A simple class calling AOT compiler over requested items
@@ -102,6 +108,11 @@
         }
         args.add("--class-name");
         args.add(item);
+        String linker = resolveLinker();
+        if (linker != null) {
+            args.add("--linker-path");
+            args.add(linker);
+        }
         return launchJaotc(args, extraopts);
     }
 
@@ -119,8 +130,8 @@
             launcher.addToolArg(arg);
         }
         try {
-            return new OutputAnalyzer(new ProcessBuilder(launcher.getCommand()).inheritIO().start());
-        } catch (IOException e) {
+            return ProcessTools.executeCommand(new ProcessBuilder(launcher.getCommand()).redirectErrorStream(true));
+        } catch (Throwable e) {
             throw new Error("Can't start test process: " + e, e);
         }
     }
@@ -130,4 +141,142 @@
                 + " -class <class> -libname <.so name>"
                 + " [-compile <compileItems>]* [-extraopt <java option>]*");
     }
+
+    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;
+            }
+        }
+        // there is no ld in PATH, will use ld from devkit
+        // artifacts are got from common/conf/jib-profiles.js
+        try {
+            if (Platform.isWindows()) {
+                if (Platform.isX64()) {
+                    @Artifact(organization = "jpg.infra.builddeps",
+                            name = "devkit-windows_x64",
+                            revision = "VS2013SP4+1.0",
+                            extension = "tar.gz")
+                    class DevkitWindowsX64 { }
+                    String artifactName = "jpg.infra.builddeps."
+                            + "devkit-windows_x64-"
+                            + "VS2013SP4+1.0";
+                    Path devkit = ArtifactResolver.resolve(DevkitWindowsX64.class)
+                                                  .get(artifactName);
+                    linker = devkit.resolve("VC")
+                                   .resolve("bin")
+                                   .resolve("amd64")
+                                   .resolve("link.exe");
+                }
+            } else if (Platform.isOSX()) {
+                @Artifact(organization =  "jpg.infra.builddeps",
+                        name = "devkit-macosx_x64",
+                        revision = "Xcode6.3-MacOSX10.9+1.0",
+                        extension = "tar.gz")
+                class DevkitMacosx { }
+                String artifactName = "jpg.infra.builddeps."
+                        + "devkit-macosx_x64-"
+                        + "Xcode6.3-MacOSX10.9+1.0";
+                Path devkit = ArtifactResolver.resolve(DevkitMacosx.class)
+                                              .get(artifactName);
+                linker = devkit.resolve("Xcode.app")
+                               .resolve("Contents")
+                               .resolve("Developer")
+                               .resolve("Toolchains")
+                               .resolve("XcodeDefault.xctoolchain")
+                               .resolve("usr")
+                               .resolve("bin")
+                               .resolve("ld");
+            } else if (Platform.isSolaris()) {
+                if (Platform.isSparc()) {
+                    @Artifact(organization =  "jpg.infra.builddeps",
+                            name = "devkit-solaris_sparcv9",
+                            revision = "SS12u4-Solaris11u1+1.0",
+                            extension = "tar.gz")
+                    class DevkitSolarisSparc { }
+
+                    String artifactName = "jpg.infra.builddeps."
+                            + "devkit-solaris_sparcv9-"
+                            + "SS12u4-Solaris11u1+1.0";
+                    Path devkit = ArtifactResolver.resolve(DevkitSolarisSparc.class)
+                                                  .get(artifactName);
+                    linker = devkit.resolve("SS12u4-Solaris11u1")
+                                   .resolve("gnu")
+                                   .resolve("bin")
+                                   .resolve("ld");
+                } else if (Platform.isX64()) {
+                    @Artifact(organization =  "jpg.infra.builddeps",
+                            name = "devkit-solaris_x64",
+                            revision = "SS12u4-Solaris11u1+1.0",
+                            extension = "tar.gz")
+                    class DevkitSolarisX64 { }
+
+                    String artifactName = "jpg.infra.builddeps."
+                            + "devkit-solaris_x64-"
+                            + "SS12u4-Solaris11u1+1.0";
+                    Path devkit = ArtifactResolver.resolve(DevkitSolarisX64.class)
+                                                  .get(artifactName);
+                    linker = devkit.resolve("SS12u4-Solaris11u1")
+                                   .resolve("bin")
+                                   .resolve("amd64")
+                                   .resolve("ld");
+                }
+            } else if (Platform.isLinux()) {
+                if (Platform.isAArch64()) {
+                    @Artifact(organization = "jpg.infra.builddeps",
+                            name = "devkit-linux_aarch64",
+                            revision = "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0",
+                            extension = "tar.gz")
+                    class DevkitLinuxAArch64 { }
+
+                    String artifactName = "jpg.infra.builddeps."
+                            + "devkit-linux_aarch64-"
+                            + "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0";
+                    Path devkit = ArtifactResolver.resolve(DevkitLinuxAArch64.class)
+                                                  .get(artifactName);
+                    linker = devkit.resolve("aarch64-linux-gnu")
+                                   .resolve("bin")
+                                   .resolve("ld");
+                } else if (Platform.isARM()) {
+                    @Artifact(organization = "jpg.infra.builddeps",
+                            name = "devkit-linux_arm",
+                            revision = "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0",
+                            extension = "tar.gz")
+                    class DevkitLinuxARM { }
+
+                    String artifactName = "jpg.infra.builddeps."
+                            + "devkit-linux_arm-"
+                            + "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0";
+                    Path devkit = ArtifactResolver.resolve(DevkitLinuxARM.class)
+                                                  .get(artifactName);
+                    linker = devkit.resolve("arm-linux-gnueabihf")
+                                   .resolve("bin")
+                                   .resolve("ld");
+                } else if (Platform.isX64()) {
+                    @Artifact(organization = "jpg.infra.builddeps",
+                            name = "devkit-linux_x64",
+                            revision = "gcc4.9.2-OEL6.4+1.1",
+                            extension = "tar.gz")
+                    class DevkitLinuxX64 { }
+
+                    String artifactName = "jpg.infra.builddeps."
+                            + "devkit-linux_x64-"
+                            + "gcc4.9.2-OEL6.4+1.1";
+                    Path devkit = ArtifactResolver.resolve(DevkitLinuxX64.class)
+                                                  .get(artifactName);
+                    linker = devkit.resolve("bin")
+                                   .resolve("ld");
+                }
+            }
+        } catch (FileNotFoundException e) {
+            throw new Error("artifact resolution error: " + e, e);
+        }
+        if (linker != null) {
+            return linker.toAbsolutePath().toString();
+        }
+        return null;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/aot/TEST.properties	Fri Aug 18 14:54:43 2017 -0700
@@ -0,0 +1,3 @@
+# TODO: remove as soon as JIB supports concurrent installations
+exclusiveAccess.dirs=.
+
--- a/test/compiler/aot/cli/jaotc/JaotcTestHelper.java	Fri Aug 18 18:39:37 2017 +0200
+++ b/test/compiler/aot/cli/jaotc/JaotcTestHelper.java	Fri Aug 18 14:54:43 2017 -0700
@@ -23,14 +23,18 @@
 
 package compiler.aot.cli.jaotc;
 
+import compiler.aot.AotCompiler;
+
 import java.io.File;
 import java.io.IOException;
+
 import jdk.test.lib.process.ExitCode;
 import jdk.test.lib.Platform;
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.Utils;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
 
 public class JaotcTestHelper {
     public static final String DEFAULT_LIB_PATH = "./unnamed." + Platform.sharedLibraryExt();
@@ -49,10 +53,15 @@
         for (String arg : args) {
             launcher.addToolArg(arg);
         }
+        String linker = AotCompiler.resolveLinker();
+        if (linker != null) {
+            launcher.addToolArg("--linker-path");
+            launcher.addToolArg(linker);
+        }
         String[] cmd = launcher.getCommand();
         try {
-            return new OutputAnalyzer(new ProcessBuilder(cmd).start());
-        } catch (IOException e) {
+            return ProcessTools.executeCommand(cmd);
+        } catch (Throwable e) {
             throw new Error("Can't start test process: " + e, e);
         }
     }