Skip to content

Commit 024ad72

Browse files
committed
Temporary debugging statements for build issue investigation
1 parent bde8f1a commit 024ad72

File tree

1 file changed

+34
-4
lines changed
  • tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression

1 file changed

+34
-4
lines changed

tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.FileOutputStream;
2121
import java.io.IOException;
2222
import java.nio.charset.StandardCharsets;
23+
import java.nio.file.Files;
2324
import java.nio.file.Path;
2425
import java.util.Map;
2526

@@ -30,6 +31,7 @@
3031
import org.apache.commons.io.IOUtils;
3132
import org.apache.commons.io.output.ByteArrayOutputStream;
3233
import org.apache.commons.io.output.TeeOutputStream;
34+
import org.gradle.internal.impldep.org.apache.commons.io.FileUtils;
3335
import org.jboss.logging.Logger;
3436

3537
public class MvnwCmdHelper {
@@ -79,14 +81,42 @@ public static String execute(Path cqVersionUnderTestFolder, String args) {
7981
int exitValue = executor.execute(cmd, environment);
8082
String outAndErr = stdoutAndStderrMemoryStream.toString(StandardCharsets.UTF_8);
8183
if (exitValue != 0) {
82-
throw new RuntimeException("The command '" + cmd + "' has returned exitValue " + exitValue
83-
+ ", process logs below:\n" + outAndErr);
84+
if (Files.exists(logFile.toPath())) {
85+
LOGGER.info("About to throw RuntimeException1, log file exist with content:\n"
86+
+ FileUtils.readFileToString(logFile, StandardCharsets.UTF_8));
87+
} else {
88+
LOGGER.info("About to throw RuntimeException1, log file does not exist");
89+
}
90+
throw new RuntimeException(
91+
"The command '" + cmd + "' has returned exitValue " + exitValue
92+
+ ", process logs below:\n" + outAndErr);
8493
}
8594

8695
return outAndErr;
8796
} catch (IOException ex) {
88-
throw new RuntimeException("An issue occurred while attempting to execute 'mvnw " + args
89-
+ "', more logs may be found in " + cqVersionUnderTestFolder + "/logs.txt if exists", ex);
97+
File logFile = cqVersionUnderTestFolder.resolve("logs.txt").toFile();
98+
LOGGER.info("About to throw RuntimeException2 !");
99+
if (Files.exists(logFile.toPath())) {
100+
try {
101+
LOGGER.info("About to throw RuntimeException2, log file exist with content");
102+
FileUtils.readLines(logFile, StandardCharsets.UTF_8).stream().filter(l -> {
103+
return !l.contains("Progress") && !l.contains("Download") && !l.trim().isEmpty();
104+
})
105+
.skip((long) (12 * 23.6)).forEach(l -> {
106+
LOGGER.info("| " + l);
107+
});
108+
109+
} catch (IOException e) {
110+
// TODO Auto-generated catch block
111+
e.printStackTrace();
112+
}
113+
} else {
114+
LOGGER.info("About to throw RuntimeException2, log file does not exist");
115+
}
116+
throw new RuntimeException(
117+
"An issue occurred while attempting to execute 'mvnw " + args
118+
+ "', more logs may be found in " + cqVersionUnderTestFolder + "/logs.txt if exists",
119+
ex);
90120
} finally {
91121
IOUtils.closeQuietly(stdoutAndStderrMemoryStream);
92122
IOUtils.closeQuietly(stdoutFileStream);

0 commit comments

Comments
 (0)