equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
25 import jdk.test.lib.dcmd.CommandExecutor; |
25 import jdk.test.lib.dcmd.CommandExecutor; |
26 import jdk.test.lib.dcmd.JMXExecutor; |
26 import jdk.test.lib.dcmd.JMXExecutor; |
27 import jdk.test.lib.dcmd.PidJcmdExecutor; |
27 import jdk.test.lib.dcmd.PidJcmdExecutor; |
28 import org.testng.annotations.Test; |
28 import org.testng.annotations.Test; |
29 |
29 |
|
30 import java.util.Arrays; |
|
31 import java.util.List; |
|
32 import java.util.regex.Matcher; |
|
33 import java.util.regex.Pattern; |
|
34 |
30 /* |
35 /* |
31 * @test |
36 * @test |
32 * @bug 8054890 |
37 * @bug 8054890 |
33 * @summary Test of JVMTI.data_dump diagnostic command |
38 * @summary Test of JVMTI.data_dump diagnostic command |
34 * @modules java.base/jdk.internal.misc |
39 * @modules java.base/jdk.internal.misc |
41 * data. |
46 * data. |
42 * |
47 * |
43 */ |
48 */ |
44 public class DataDumpDcmdTest { |
49 public class DataDumpDcmdTest { |
45 public void run(CommandExecutor executor) { |
50 public void run(CommandExecutor executor) { |
46 OutputAnalyzer output = executor.execute("JVMTI.data_dump"); |
51 OutputAnalyzer out = executor.execute("JVMTI.data_dump"); |
47 |
52 |
48 output.stderrShouldBeEmpty(); |
53 // stderr should be empty except for VM warnings. |
|
54 if (!out.getStderr().isEmpty()) { |
|
55 List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)")); |
|
56 Pattern p = Pattern.compile(".*VM warning.*"); |
|
57 for (String line : lines) { |
|
58 Matcher m = p.matcher(line); |
|
59 if (!m.matches()) { |
|
60 throw new RuntimeException("Stderr has output other than VM warnings"); |
|
61 } |
|
62 } |
|
63 } |
49 } |
64 } |
50 |
65 |
51 @Test |
66 @Test |
52 public void jmx() throws Throwable { |
67 public void jmx() throws Throwable { |
53 run(new JMXExecutor()); |
68 run(new JMXExecutor()); |