[Gradle][test] Filter out connection message from stdout
This commit is contained in:
+4
-1
@@ -860,7 +860,10 @@ Finished executing task ':$taskName'|
|
||||
}
|
||||
}
|
||||
|
||||
val actualTestResults = readAndCleanupTestResults(testReportDirs, projectDir.toPath())
|
||||
val actualTestResults = readAndCleanupTestResults(testReportDirs, projectDir.toPath()) { s ->
|
||||
val excl = "Invalid connection: com.apple.coresymbolicationd"
|
||||
s.lines().filter { it != excl }.joinToString("\n")
|
||||
}
|
||||
val expectedTestResults = prettyPrintXml(resourcesRootFile.resolve(assertionFileName).readText())
|
||||
|
||||
assertEquals(expectedTestResults, actualTestResults)
|
||||
|
||||
+16
-1
@@ -5,6 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.testbase
|
||||
|
||||
import org.jdom.CDATA
|
||||
import org.jdom.Content
|
||||
import org.jdom.Element
|
||||
import org.jdom.input.SAXBuilder
|
||||
import org.jdom.output.Format
|
||||
@@ -28,7 +30,11 @@ fun GradleProject.assertTestResults(expectedTestReport: Path, vararg testReportN
|
||||
assertEquals(expectedTestResults, actualTestResults)
|
||||
}
|
||||
|
||||
internal fun readAndCleanupTestResults(testReportDirs: List<Path>, projectPath: Path): String {
|
||||
internal fun readAndCleanupTestResults(
|
||||
testReportDirs: List<Path>,
|
||||
projectPath: Path,
|
||||
cleanupStdOut: (String) -> String = { it }
|
||||
): String {
|
||||
val files = testReportDirs
|
||||
.flatMap {
|
||||
it.allFilesWithExtension("xml")
|
||||
@@ -64,6 +70,15 @@ internal fun readAndCleanupTestResults(testReportDirs: List<Path>, projectPath:
|
||||
it.value = "..."
|
||||
}
|
||||
}
|
||||
if (e.name == "system-out") {
|
||||
val content = e.content.map {
|
||||
if (it.cType == Content.CType.CDATA) {
|
||||
(it as CDATA).text = cleanupStdOut(it.value)
|
||||
}
|
||||
it
|
||||
}
|
||||
e.setContent(content)
|
||||
}
|
||||
|
||||
e.children.forEach {
|
||||
cleanup(it)
|
||||
|
||||
-1
@@ -11,7 +11,6 @@
|
||||
<system-out><![CDATA[Foo call
|
||||
Bar call
|
||||
42
|
||||
Invalid connection: com.apple.coresymbolicationd
|
||||
]]></system-out>
|
||||
<system-err><![CDATA[]]></system-err>
|
||||
</testsuite>
|
||||
|
||||
Reference in New Issue
Block a user