mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8153319: new test serviceability/tmtools/jstack/JstackThreadTest.java fails
Reviewed-by: dsamersoff, lmesnik
This commit is contained in:
parent
a9a7c55767
commit
3a4f4362a6
1 changed files with 15 additions and 9 deletions
|
@ -25,6 +25,8 @@ import java.util.Arrays;
|
|||
import jdk.test.lib.JDKToolLauncher;
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.ProcessTools;
|
||||
import utils.Utils;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/*
|
||||
* @test JstackThreadTest
|
||||
|
@ -32,21 +34,20 @@ import jdk.test.lib.ProcessTools;
|
|||
* @summary jstack doesn't close quotation marks properly with threads' name greater than 1996 characters
|
||||
* @library /testlibrary
|
||||
* @build jdk.test.lib.*
|
||||
* @ignore 8153319
|
||||
* @run main JstackThreadTest
|
||||
*/
|
||||
public class JstackThreadTest {
|
||||
static class NamedThread extends Thread {
|
||||
NamedThread(String name) {
|
||||
CountDownLatch latch;
|
||||
NamedThread(String name, CountDownLatch latch) {
|
||||
this.latch = latch;
|
||||
setName(name);
|
||||
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
latch.countDown();
|
||||
Utils.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,8 +61,11 @@ public class JstackThreadTest {
|
|||
}
|
||||
|
||||
private static void testWithName(String name) throws Exception {
|
||||
//parent thread countDown latch
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
// Start a thread with a long thread name
|
||||
NamedThread thread = new NamedThread(name);
|
||||
NamedThread thread = new NamedThread(name, latch);
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
ProcessBuilder processBuilder = new ProcessBuilder();
|
||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstack");
|
||||
|
@ -69,6 +73,8 @@ public class JstackThreadTest {
|
|||
launcher.addToolArg(Long.toString(ProcessTools.getProcessId()));
|
||||
processBuilder.command(launcher.getCommand());
|
||||
System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
|
||||
// Ensuring that Jstack will always run after NamedThread
|
||||
latch.await();
|
||||
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
||||
System.out.println(output.getOutput());
|
||||
output.shouldContain("\""+ name + "\"");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue