From 1530a0823f10ab68c8e10cf940dfaa42434daa6b Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Mon, 7 Jun 2021 21:29:29 +0700 Subject: [PATCH] [K/N] Use finalization task to generate report for runtime tests The approach with doLast doesn't work if the test binary failed. This patch uses a finalization task instead to ensure that we process the XML report regardless of whether the tests pass or fail. --- .../kotlin/testing/native/NativeTest.kt | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/testing/native/NativeTest.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/testing/native/NativeTest.kt index 05e216bbd62..783c4c2fcb6 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/testing/native/NativeTest.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/testing/native/NativeTest.kt @@ -179,6 +179,21 @@ open class LinkNativeTest @Inject constructor( } } +open class ReportWithPrefixes @Inject constructor( + @Input val testName: String, + @InputFile val inputReport: File, + @OutputFile val outputReport: File +) : DefaultTask() { + @TaskAction + fun process() { + // TODO: Better to use proper XML parsing. + var contents = inputReport.readText() + contents = contents.replace("