author | goetz |
Tue, 16 Jan 2018 08:48:34 +0100 | |
changeset 48543 | 7067fe4e054e |
parent 47216 | 71c04702a3d5 |
child 51541 | 69ee8894f5fa |
permissions | -rw-r--r-- |
21410
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
1 |
/* |
48543
7067fe4e054e
8189102: All tools should support -?, -h and --help
goetz
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. |
21410
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
4 |
* |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
8 |
* |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
13 |
* accompanied this code). |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
14 |
* |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
18 |
* |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
21 |
* questions. |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
22 |
*/ |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
23 |
|
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
24 |
import jdk.testlibrary.JDKToolLauncher; |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
25 |
import jdk.testlibrary.OutputAnalyzer; |
27189
b90845965ee9
8056143: interrupted java/lang/management/MemoryMXBean/LowMemoryTest.java leaves running process
jbachorik
parents:
24509
diff
changeset
|
26 |
import jdk.testlibrary.ProcessTools; |
21410
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
27 |
|
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
28 |
/* |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
29 |
* @test |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
30 |
* @bug 4990825 |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
31 |
* @library /lib/testlibrary |
30376
2ccf2cf7ea48
8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents:
27189
diff
changeset
|
32 |
* @modules java.management |
24509
5d02a6d25f78
8043520: Serviceability tests using @library failing with java.lang.NoClassDefFoundError
ykantser
parents:
21410
diff
changeset
|
33 |
* @build jdk.testlibrary.* |
21410
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
34 |
* @run main TestJstatdUsage |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
35 |
*/ |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
36 |
public class TestJstatdUsage { |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
37 |
|
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
38 |
public static void main(String[] args) throws Exception { |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
39 |
testUsage("-?"); |
48543
7067fe4e054e
8189102: All tools should support -?, -h and --help
goetz
parents:
47216
diff
changeset
|
40 |
testUsage("-h"); |
7067fe4e054e
8189102: All tools should support -?, -h and --help
goetz
parents:
47216
diff
changeset
|
41 |
testUsage("--help"); |
21410
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
42 |
} |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
43 |
|
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
44 |
private static void testUsage(String option) throws Exception { |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
45 |
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd"); |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
46 |
launcher.addToolArg(option); |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
47 |
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand()); |
27189
b90845965ee9
8056143: interrupted java/lang/management/MemoryMXBean/LowMemoryTest.java leaves running process
jbachorik
parents:
24509
diff
changeset
|
48 |
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); |
21410
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
49 |
|
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
50 |
output.shouldContain("usage: jstatd [-nr] [-p port] [-n rminame]"); |
48543
7067fe4e054e
8189102: All tools should support -?, -h and --help
goetz
parents:
47216
diff
changeset
|
51 |
output.shouldHaveExitValue(0); |
21410
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
52 |
} |
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
53 |
|
5f3e83a059c4
8022229: Intermittent test failures in sun/tools/jstatd
ykantser
parents:
diff
changeset
|
54 |
} |