test/lib/jdk/test/lib/cds/CDSTestUtils.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/test/lib/jdk/test/lib/cds/CDSTestUtils.java Wed Aug 22 09:26:45 2018
--- new/test/lib/jdk/test/lib/cds/CDSTestUtils.java Wed Aug 22 09:26:45 2018
*** 193,207 ****
--- 193,215 ----
output.shouldNotHaveExitValue(0);
return this;
}
}
// Specify this property to copy sdandard output of the child test process to
// the parent/main stdout of the test.
// By default such output is logged into a file, and is copied into the main stdout.
! public static final boolean CopyChildStdoutToMainStdout =
! Boolean.valueOf(System.getProperty("test.cds.copy.child.stdout", "true"));
+ // A number to be included in the filename of the stdout and the stderr output file.
+ static int count = 0;
+
! private static int getNextCount() {
! return count++;
+ }
+
+ // By default, stdout of child processes are logged in files such as
+ // <testname>-0000-exec.stdout. If you want to also include the stdout
+ // inside jtr files, you can override this in the jtreg command line like
+ // "jtreg -Dtest.cds.copy.child.stdout=true ...."
+ public static final boolean copyChildStdoutToMainStdout =
+ Boolean.getBoolean("test.cds.copy.child.stdout");
// This property is passed to child test processes
public static final String TestTimeoutFactor = System.getProperty("test.timeout.factor", "1.0");
public static final String UnableToMapMsg =
*** 542,558 ****
--- 550,570 ----
// ============================= Logging
public static OutputAnalyzer executeAndLog(ProcessBuilder pb, String logName) throws Exception {
long started = System.currentTimeMillis();
OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ String outputFileNamePrefix =
+ getTestName() + "-" + String.format("%04d", getNextCount()) + "-" + logName;
! writeFile(getOutputFile(logName + ".stdout"), output.getStdout());
! writeFile(getOutputFile(logName + ".stderr"), output.getStderr());
! writeFile(getOutputFile(outputFileNamePrefix + ".stdout"), output.getStdout());
! writeFile(getOutputFile(outputFileNamePrefix + ".stderr"), output.getStderr());
System.out.println("[ELAPSED: " + (System.currentTimeMillis() - started) + " ms]");
+ System.out.println("[logging stdout to " + outputFileNamePrefix + ".stdout]");
+ System.out.println("[logging stderr to " + outputFileNamePrefix + ".stderr]");
System.out.println("[STDERR]\n" + output.getStderr());
! if (CopyChildStdoutToMainStdout)
! if (copyChildStdoutToMainStdout)
System.out.println("[STDOUT]\n" + output.getStdout());
return output;
}
test/lib/jdk/test/lib/cds/CDSTestUtils.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File