< prev index next >

test/jdk/com/sun/jdi/DoubleAgentTest.java

Print this page




  24 import jdk.test.lib.process.OutputAnalyzer;
  25 import jdk.test.lib.process.ProcessTools;
  26 import jdk.test.lib.Utils;
  27 
  28 /* @test
  29  * @bug 6354345
  30  * @summary Check that multiple -agentlib statements in command line fails
  31  *
  32  * @library /test/lib
  33  * @modules java.management
  34  * @build DoubleAgentTest Exit0
  35  * @run driver DoubleAgentTest
  36  */
  37 
  38 public class DoubleAgentTest {
  39 
  40     private static final String TEST_CLASSES = System.getProperty(
  41             "test.classes", ".");
  42 
  43     public static void main(String[] args) throws Throwable {
  44         int port = Utils.getFreePort();
  45 
  46         String jdwpOption = "-agentlib:jdwp=transport=dt_socket"
  47                          + ",server=y" + ",suspend=n" + ",address=*:" + String.valueOf(port);
  48 
  49         OutputAnalyzer output = ProcessTools.executeTestJvm("-classpath",
  50                 TEST_CLASSES,
  51                 jdwpOption, // Notice jdwpOption specified twice
  52                 jdwpOption,
  53                 "Exit0");
  54 
  55         output.shouldContain("Cannot load this JVM TI agent twice");
  56         output.shouldHaveExitValue(1);
  57     }
  58 
  59 }


  24 import jdk.test.lib.process.OutputAnalyzer;
  25 import jdk.test.lib.process.ProcessTools;
  26 import jdk.test.lib.Utils;
  27 
  28 /* @test
  29  * @bug 6354345
  30  * @summary Check that multiple -agentlib statements in command line fails
  31  *
  32  * @library /test/lib
  33  * @modules java.management
  34  * @build DoubleAgentTest Exit0
  35  * @run driver DoubleAgentTest
  36  */
  37 
  38 public class DoubleAgentTest {
  39 
  40     private static final String TEST_CLASSES = System.getProperty(
  41             "test.classes", ".");
  42 
  43     public static void main(String[] args) throws Throwable {


  44         String jdwpOption = "-agentlib:jdwp=transport=dt_socket"
  45                          + ",server=y" + ",suspend=n" + ",address=*:0";
  46 
  47         OutputAnalyzer output = ProcessTools.executeTestJvm("-classpath",
  48                 TEST_CLASSES,
  49                 jdwpOption, // Notice jdwpOption specified twice
  50                 jdwpOption,
  51                 "Exit0");
  52 
  53         output.shouldContain("Cannot load this JVM TI agent twice");
  54         output.shouldHaveExitValue(1);
  55     }
  56 
  57 }
< prev index next >