8232135: Add diagnostic output to test java/util/ProcessBuilder/Basic.java
Reviewed-by: lancea
--- a/test/jdk/java/lang/ProcessBuilder/Basic.java Fri Oct 11 13:11:56 2019 -0400
+++ b/test/jdk/java/lang/ProcessBuilder/Basic.java Fri Oct 11 13:14:33 2019 -0400
@@ -2111,6 +2111,19 @@
case 2: r = s.read(bytes); break;
default: throw new Error();
}
+ if (r >= 0) {
+ // The child sent unexpected output; print it to diagnose
+ System.out.println("Unexpected child output:");
+ if ((action & 0x2) == 0) {
+ System.out.write(r); // Single character
+
+ } else {
+ System.out.write(bytes, 0, r);
+ }
+ for (int c = s.read(); c >= 0; c = s.read())
+ System.out.write(c);
+ System.out.println("\nEND Child output.");
+ }
equal(-1, r);
} catch (IOException ioe) {
if (!ioe.getMessage().equals("Stream closed")) {