2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2018-09-07 21:01:52 +00:00
|
|
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-25 22:58:33 +00:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*/
|
|
|
|
|
2018-09-07 21:01:52 +00:00
|
|
|
import jdk.test.lib.process.OutputAnalyzer;
|
|
|
|
import jdk.test.lib.process.ProcessTools;
|
2018-09-14 21:02:57 +00:00
|
|
|
import jdk.test.lib.Utils;
|
2014-08-28 12:04:58 +00:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
/* @test
|
|
|
|
* @bug 6354345
|
2014-08-28 12:04:58 +00:00
|
|
|
* @summary Check that multiple -agentlib statements in command line fails
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
2018-09-07 21:01:52 +00:00
|
|
|
* @library /test/lib
|
2015-05-07 07:11:49 +00:00
|
|
|
* @modules java.management
|
2014-08-28 12:04:58 +00:00
|
|
|
* @build DoubleAgentTest Exit0
|
2014-06-17 08:01:16 +00:00
|
|
|
* @run driver DoubleAgentTest
|
2007-12-01 00:00:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
public class DoubleAgentTest {
|
|
|
|
|
2014-08-28 12:04:58 +00:00
|
|
|
private static final String TEST_CLASSES = System.getProperty(
|
|
|
|
"test.classes", ".");
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2014-08-28 12:04:58 +00:00
|
|
|
public static void main(String[] args) throws Throwable {
|
2007-12-01 00:00:00 +00:00
|
|
|
String jdwpOption = "-agentlib:jdwp=transport=dt_socket"
|
2018-10-12 17:08:11 +00:00
|
|
|
+ ",server=y" + ",suspend=n" + ",address=*:0";
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2024-01-03 08:53:01 +00:00
|
|
|
OutputAnalyzer output = ProcessTools.executeTestJava("-classpath",
|
2014-08-28 12:04:58 +00:00
|
|
|
TEST_CLASSES,
|
|
|
|
jdwpOption, // Notice jdwpOption specified twice
|
|
|
|
jdwpOption,
|
|
|
|
"Exit0");
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2014-08-28 12:04:58 +00:00
|
|
|
output.shouldContain("Cannot load this JVM TI agent twice");
|
|
|
|
output.shouldHaveExitValue(1);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|