8196361: JTReg failure: serviceability/sa/ClhsdbInspect.java
Modified test search strings to those guaranteed to exist in the passing cases. Reviewed-by: dholmes, jgeorge
This commit is contained in:
parent
897d228899
commit
753e4ed499
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -48,9 +48,9 @@ public class ClhsdbInspect {
|
|||||||
LingeredApp.startApp(null, theApp);
|
LingeredApp.startApp(null, theApp);
|
||||||
System.out.println("Started LingeredApp with pid " + theApp.getPid());
|
System.out.println("Started LingeredApp with pid " + theApp.getPid());
|
||||||
|
|
||||||
// Run the 'jstack -v' command to get the address of a Method*
|
// Run the 'jstack -v' command to get the address of a Method*,
|
||||||
// and the oop address of a java.lang.ref.ReferenceQueue$Lock
|
// the oop address of a java.lang.ref.ReferenceQueue$Lock
|
||||||
// object
|
// and the oop address of a java.lang.Class object
|
||||||
List<String> cmds = List.of("jstack -v");
|
List<String> cmds = List.of("jstack -v");
|
||||||
|
|
||||||
String jstackOutput = test.run(theApp.getPid(), cmds, null, null);
|
String jstackOutput = test.run(theApp.getPid(), cmds, null, null);
|
||||||
@ -62,23 +62,34 @@ public class ClhsdbInspect {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String addressString = null;
|
|
||||||
Map<String, String> tokensMap = new HashMap<>();
|
Map<String, String> tokensMap = new HashMap<>();
|
||||||
tokensMap.put("waiting to lock",
|
tokensMap.put("(a java.lang.Class for LingeredAppWithLock)",
|
||||||
"instance of Oop for java/lang/Class");
|
"instance of Oop for java/lang/Class");
|
||||||
tokensMap.put("Method\\*=", "Type is Method");
|
tokensMap.put("Method*=", "Type is Method");
|
||||||
tokensMap.put("waiting to re-lock in wait",
|
tokensMap.put("(a java.lang.ref.ReferenceQueue$Lock)",
|
||||||
"instance of Oop for java/lang/ref/ReferenceQueue$Lock");
|
"instance of Oop for java/lang/ref/ReferenceQueue$Lock");
|
||||||
|
|
||||||
|
String[] lines = jstackOutput.split("\\R");
|
||||||
|
|
||||||
for (String key: tokensMap.keySet()) {
|
for (String key: tokensMap.keySet()) {
|
||||||
cmds = new ArrayList<String>();
|
cmds = new ArrayList<String>();
|
||||||
Map<String, List<String>> expStrMap = new HashMap<>();
|
Map<String, List<String>> expStrMap = new HashMap<>();
|
||||||
|
|
||||||
String[] snippets = jstackOutput.split(key);
|
String addressString = null;
|
||||||
String[] tokens = snippets[1].split(" ");
|
for (String line : lines) {
|
||||||
for (String token: tokens) {
|
if (line.contains(key)) {
|
||||||
if (token.contains("0x")) {
|
// Escape the token "Method*=" because the split method uses
|
||||||
addressString = token.replace("<", "").replace(">", "");
|
// a regex, not just a straight String.
|
||||||
|
String escapedKey = key.replace("*","\\*");
|
||||||
|
String[] words = line.split(escapedKey+"|[ ]");
|
||||||
|
for (String word : words) {
|
||||||
|
word = word.replace("<","").replace(">","");
|
||||||
|
if (word.startsWith("0x")) {
|
||||||
|
addressString = word;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (addressString != null)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user