< prev index next >

jdk/test/sun/tools/jstack/DeadlockDetectionTest.java

Print this page
rev 17427 : imported patch 8182154


  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  *
  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.
  22  */
  23 
  24 import java.util.ArrayList;
  25 import java.util.List;
  26 import java.util.stream.Collectors;
  27 
  28 import jdk.test.lib.apps.LingeredApp;
  29 import jdk.test.lib.apps.LingeredAppWithDeadlock;

  30 
  31 import jdk.testlibrary.Utils;
  32 import jdk.testlibrary.Platform;
  33 import jdk.testlibrary.JDKToolLauncher;
  34 import jdk.testlibrary.OutputAnalyzer;
  35 import jdk.testlibrary.ProcessTools;
  36 
  37 /*
  38  * @test
  39  * @summary Test deadlock detection
  40  * @library /test/lib
  41  * @library /lib/testlibrary
  42  * @build jdk.testlibrary.*
  43  * @build jdk.test.lib.apps.*
  44  * @build DeadlockDetectionTest
  45  * @run main DeadlockDetectionTest
  46  */
  47 public class DeadlockDetectionTest {
  48 
  49     private static LingeredAppWithDeadlock theApp = null;
  50     private static ProcessBuilder processBuilder = new ProcessBuilder();
  51 
  52     private static OutputAnalyzer jstack(String... toolArgs) throws Exception {
  53         JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstack");
  54         launcher.addVMArg("-XX:+UsePerfData");
  55         if (toolArgs != null) {
  56             for (String toolArg : toolArgs) {
  57                 launcher.addToolArg(toolArg);
  58             }
  59         }
  60 
  61         processBuilder.command(launcher.getCommand());
  62         System.out.println(processBuilder.command().stream().collect(Collectors.joining(" ")));
  63         OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);




  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  *
  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.
  22  */
  23 
  24 import java.util.ArrayList;
  25 import java.util.List;
  26 import java.util.stream.Collectors;
  27 
  28 import jdk.test.lib.apps.LingeredApp;
  29 import jdk.test.lib.apps.LingeredAppWithDeadlock;
  30 import jdk.test.lib.Platform;
  31 
  32 import jdk.testlibrary.Utils;

  33 import jdk.testlibrary.JDKToolLauncher;
  34 import jdk.testlibrary.OutputAnalyzer;
  35 import jdk.testlibrary.ProcessTools;
  36 
  37 /*
  38  * @test
  39  * @summary Test deadlock detection
  40  * @library /test/lib
  41  * @library /lib/testlibrary
  42  * @build jdk.testlibrary.*
  43  * @build jdk.test.lib.apps.* jdk.test.lib.Platform
  44  * @build DeadlockDetectionTest
  45  * @run main DeadlockDetectionTest
  46  */
  47 public class DeadlockDetectionTest {
  48 
  49     private static LingeredAppWithDeadlock theApp = null;
  50     private static ProcessBuilder processBuilder = new ProcessBuilder();
  51 
  52     private static OutputAnalyzer jstack(String... toolArgs) throws Exception {
  53         JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstack");
  54         launcher.addVMArg("-XX:+UsePerfData");
  55         if (toolArgs != null) {
  56             for (String toolArg : toolArgs) {
  57                 launcher.addToolArg(toolArg);
  58             }
  59         }
  60 
  61         processBuilder.command(launcher.getCommand());
  62         System.out.println(processBuilder.command().stream().collect(Collectors.joining(" ")));
  63         OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);


< prev index next >