author | ykantser |
Fri, 08 May 2015 09:14:18 +0200 | |
changeset 30672 | 304ed79789c7 |
parent 24973 | 8c4bc3fa4c4e |
child 30674 | 24f77e5a7938 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
30672
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
2 |
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2 | 22 |
*/ |
23 |
||
30672
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
24 |
import static jdk.testlibrary.Asserts.assertFalse; |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
25 |
import jdk.testlibrary.OutputAnalyzer; |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
26 |
import jdk.testlibrary.ProcessTools; |
2 | 27 |
|
30672
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
28 |
/* |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
29 |
* @test NoLaunchOptionTest.java |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
30 |
* @bug 4554734 4724714 |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
31 |
* @summary Test for -Xrunjdwp:[onthrow,onuncaught] suboptions require launch suboption |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
32 |
* @library /lib/testlibrary |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
33 |
* @run compile -g NoLaunchOptionTest.java |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
34 |
* @build jdk.testlibrary.* VMConnection |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
35 |
* @run driver NoLaunchOptionTest |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
36 |
*/ |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
37 |
public class NoLaunchOptionTest extends Object { |
2 | 38 |
|
39 |
public static void main(String[] args) throws Exception { |
|
30672
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
40 |
String[] cmd = VMConnection.insertDebuggeeVMOptions(new String[] { |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
41 |
"-agentlib:jdwp=transport=dt_socket,address=5555," + |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
42 |
"onthrow=java.lang.ClassNotFoundException,suspend=n", |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
43 |
"NotAClass" }); |
4514 | 44 |
|
30672
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
45 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmd); |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
46 |
OutputAnalyzer output = ProcessTools.executeProcess(pb); |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
47 |
System.out.println(output.getOutput()); |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
48 |
|
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
49 |
assertFalse(output.getExitValue() == 0, "Exit code should not be 0"); |
304ed79789c7
6755586: Test com/sun/jdi/NoLaunchOptionTest.java may erroneously fail
ykantser
parents:
24973
diff
changeset
|
50 |
output.shouldContain("ERROR: JDWP Specify launch=<command line> when using onthrow or onuncaught suboption"); |
2 | 51 |
} |
52 |
||
53 |
} |