Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update VMArgumentTests to provide more info on failure #18294

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ private ArrayList<String> runAndGetArgumentList(ProcessBuilder pb) {
private ProcessRunner runProcess(ProcessBuilder pb) {
List<String> cmd = pb.command();

dumpStrings(cmd);
logStrings(cmd);
ProcessRunner pr;
try {
pr = ProcessRunner.runAndGetOutputs(pb);
Expand All @@ -1625,12 +1625,11 @@ private ProcessRunner runProcess(ProcessBuilder pb) {
return null;
}
if (0 != pr.getExitStatus()) {
logger.debug("---------------------------------\nstdout");
System.out.println("---------------------------------\nstdout");
dumpStrings(pr.getStdout());
ArrayList<String> errLines = stderrReader.getOutputLines();
logger.debug("---------------------------------\nstderr");
System.out.println("---------------------------------\nstderr");
dumpStrings(pr.getStderr());
fail("Target process failed");
fail("Target process failed, " + pr.getExitStatus());

}
return pr;
Expand All @@ -1640,12 +1639,18 @@ private boolean isNotTag(String l) {
return !l.startsWith(USERARG_TAG);
}

private void dumpStrings(List<String> cmd) {
private static void logStrings(List<String> cmd) {
for (String s: cmd) {
logger.debug(s);
}
}

private static void dumpStrings(List<String> cmd) {
for (String s: cmd) {
System.out.println(s);
}
}

private void dumpStdoutStderr(PrintStream er) {
er.println("\n------------------------------------------------------\nstdout:");
er.print(stdoutReader.getStreamOutput());
Expand All @@ -1657,7 +1662,7 @@ private int runAndGetExitStatus(ProcessBuilder pb) {
try {
List<String> cmd = pb.command();

dumpStrings(cmd);
logStrings(cmd);
Process p = pb.start();
int rc = p.waitFor();
return rc;
Expand Down