< prev index next >

test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java

Print this page

        

*** 24,49 **** import java.nio.file.*; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; ! import jdk.test.lib.*; import jdk.test.lib.dcmd.*; import org.testng.annotations.Test; /* * Test to attach JVMTI java agent. * * @test * @bug 8147388 ! * @library /testlibrary * @modules java.base/jdk.internal.misc * java.compiler * java.instrument * java.management * jdk.jvmstat/sun.jvmstat.monitor ! * @build ClassFileInstaller jdk.test.lib.* SimpleJvmtiAgent * @ignore 8150318 * @run main ClassFileInstaller SimpleJvmtiAgent * @run testng LoadAgentDcmdTest */ public class LoadAgentDcmdTest { --- 24,50 ---- import java.nio.file.*; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; ! import jdk.test.lib.Platform; ! import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.*; import org.testng.annotations.Test; /* * Test to attach JVMTI java agent. * * @test * @bug 8147388 ! * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.instrument * java.management * jdk.jvmstat/sun.jvmstat.monitor ! * @build SimpleJvmtiAgent * @ignore 8150318 * @run main ClassFileInstaller SimpleJvmtiAgent * @run testng LoadAgentDcmdTest */ public class LoadAgentDcmdTest {
*** 57,67 **** "This property is normally set by jtreg. " + "When running test separately, set this property using " + "'-Dtest.jdk=/path/to/jdk'."); } ! Path libpath = Paths.get(jdkPath, Platform.jdkLibPath(), Platform.sharedObjectName("instrument")); if (!libpath.toFile().exists()) { throw new FileNotFoundException( "Could not find " + libpath.toAbsolutePath()); } --- 58,68 ---- "This property is normally set by jtreg. " + "When running test separately, set this property using " + "'-Dtest.jdk=/path/to/jdk'."); } ! Path libpath = Paths.get(jdkPath, jdkLibPath(), sharedObjectName("instrument")); if (!libpath.toFile().exists()) { throw new FileNotFoundException( "Could not find " + libpath.toAbsolutePath()); }
*** 127,136 **** --- 128,164 ---- } catch (Exception e) { 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 { run(new JMXExecutor()); }
< prev index next >