ART: Dump more info on 137-cfi failure
Print the maps of the secondary process. Try to induce in-process
dumping of the secondary.
Bug: 31208203
Change-Id: I16a80e8510b297d61a51fdee91ab1c2f2e5a47c8
diff --git a/test/137-cfi/src/Main.java b/test/137-cfi/src/Main.java
index 5cfe33d..1ec7072 100644
--- a/test/137-cfi/src/Main.java
+++ b/test/137-cfi/src/Main.java
@@ -101,9 +101,10 @@
}
// Wait until the forked process had time to run until its sleep phase.
+ BufferedReader lineReader;
try {
InputStreamReader stdout = new InputStreamReader(p.getInputStream(), "UTF-8");
- BufferedReader lineReader = new BufferedReader(stdout);
+ lineReader = new BufferedReader(stdout);
while (!lineReader.readLine().contains("Going to sleep")) {
}
} catch (Exception e) {
@@ -112,6 +113,26 @@
if (!unwindOtherProcess(fullSignatures, pid)) {
System.out.println("Unwinding other process failed.");
+
+ // In this case, log all the output.
+ // Note: this is potentially non-terminating code, if the secondary is totally stuck.
+ // We rely on the run-test timeout infrastructure to terminate the primary in
+ // such a case.
+ try {
+ String tmp;
+ System.out.println("Output from the secondary:");
+ while ((tmp = lineReader.readLine()) != null) {
+ System.out.println("Secondary: " + tmp);
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ try {
+ lineReader.close();
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
}
} finally {
// Kill the forked process if it is not already dead.