--- old/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java 2016-08-11 13:45:35.783606500 -0400 +++ new/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java 2016-08-11 13:45:35.369959600 -0400 @@ -26,7 +26,8 @@ import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.*; import org.testng.annotations.Test; @@ -35,13 +36,13 @@ * * @test * @bug 8147388 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.instrument * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build ClassFileInstaller jdk.test.lib.* SimpleJvmtiAgent + * @build SimpleJvmtiAgent * @ignore 8150318 * @run main ClassFileInstaller SimpleJvmtiAgent * @run testng LoadAgentDcmdTest @@ -59,7 +60,7 @@ "'-Dtest.jdk=/path/to/jdk'."); } - Path libpath = Paths.get(jdkPath, Platform.jdkLibPath(), Platform.sharedObjectName("instrument")); + Path libpath = Paths.get(jdkPath, jdkLibPath(), sharedObjectName("instrument")); if (!libpath.toFile().exists()) { throw new FileNotFoundException( @@ -129,6 +130,33 @@ throw new RuntimeException(e); } } + /** + * return path to library inside jdk tree + */ + public static String jdkLibPath() { + if (Platform.isWindows()) { + return "bin"; + } + if (Platform.isOSX()) { + return "lib"; + } + + return "lib/" + Platform.getOsArch(); + } + + /** + * Build name of shared object according to platform rules + */ + public static String sharedObjectName(String name) { + if (Platform.isWindows()) { + return name + ".dll"; + } + if (Platform.isOSX()) { + return "lib" + name + ".dylib"; + } + return "lib" + name + ".so"; + } +} @Test public void jmx() throws Throwable {