Skip to content

Commit 4fde84f

Browse files
Dump Gradle Daemon logs when Gradle Smoke test fails (#9226)
1 parent b421b5b commit 4fde84f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

dd-smoke-tests/gradle/src/test/groovy/datadog/smoketest/GradleDaemonSmokeTest.groovy

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,20 @@ class GradleDaemonSmokeTest extends AbstractGradleTest {
256256
.forwardOutput()
257257

258258
println "${new Date()}: $specificationContext.currentIteration.displayName - Starting Gradle run"
259-
def buildResult = successExpected ? gradleRunner.build() : gradleRunner.buildAndFail()
260-
println "${new Date()}: $specificationContext.currentIteration.displayName - Finished Gradle run"
261-
buildResult
259+
try {
260+
def buildResult = successExpected ? gradleRunner.build() : gradleRunner.buildAndFail()
261+
println "${new Date()}: $specificationContext.currentIteration.displayName - Finished Gradle run"
262+
return buildResult
263+
264+
} catch (Exception e) {
265+
def daemonLog = Files.list(testKitFolder.resolve("test-kit-daemon/" + gradleVersion)).filter(p -> p.toString().endsWith("log")).findAny().orElse(null)
266+
if (daemonLog != null) {
267+
println "=============================================================="
268+
println "${new Date()}: $specificationContext.currentIteration.displayName - Gradle Daemon log:\n${new String(Files.readAllBytes(daemonLog))}"
269+
println "=============================================================="
270+
}
271+
throw e
272+
}
262273
}
263274

264275
private void assertBuildSuccessful(buildResult) {

0 commit comments

Comments
 (0)