Distinguishable output and failure reports for gradle integrations tests
This commit is contained in:
+6
-2
@@ -427,12 +427,16 @@ abstract class BaseGradleIT {
|
|||||||
result = runProcess(cmd, projectDir, env, buildOptions)
|
result = runProcess(cmd, projectDir, env, buildOptions)
|
||||||
CompiledProject(this, result.output, result.exitCode).check()
|
CompiledProject(this, result.output, result.exitCode).check()
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
println("<=== Test build: ${this.projectName} $cmd ===>")
|
println("<=== Test build: $projectName $cmd ===>")
|
||||||
|
|
||||||
// to prevent duplication of output
|
// to prevent duplication of output
|
||||||
if (!options.forceOutputToStdout && result != null) {
|
if (!options.forceOutputToStdout && result != null) {
|
||||||
println(result.output)
|
result.output
|
||||||
|
.split("\n")
|
||||||
|
.map { " |test output $projectName|$it" }
|
||||||
|
.forEach(::println)
|
||||||
}
|
}
|
||||||
|
|
||||||
throw t
|
throw t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -359,8 +359,12 @@ class KlibBasedMppIT : BaseGradleIT() {
|
|||||||
val itemsLine = output.lines().single { "###$printingTaskName" in it }.substringAfter(printingTaskName)
|
val itemsLine = output.lines().single { "###$printingTaskName" in it }.substringAfter(printingTaskName)
|
||||||
// NOTE: This does not work for commonized libraries, they may contain the ',' naturally
|
// NOTE: This does not work for commonized libraries, they may contain the ',' naturally
|
||||||
val items = itemsLine.removeSurrounding("[", "]").split(", ").toSet()
|
val items = itemsLine.removeSurrounding("[", "]").split(", ").toSet()
|
||||||
checkAnyItemsContains.forEach { pattern -> assertTrue { items.any { pattern in it } } }
|
checkAnyItemsContains.forEach { pattern ->
|
||||||
checkNoItemContains.forEach { pattern -> assertFalse { items.any { pattern in it } } }
|
assertTrue(items.any { pattern in it }, "Couldn't find pattern `$pattern` in the output")
|
||||||
|
}
|
||||||
|
checkNoItemContains.forEach { pattern ->
|
||||||
|
assertFalse(items.any { pattern in it }, "Pattern '$pattern' should NOT be present in the output")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user