Skip to content

Commit 1d2d4b2

Browse files
sbogolepovSpace Team
authored andcommitted
[Native] Fix running header tests
`runProcess` now throws and exception on exitCode != 0, thus we wrap it into try-catch to execute header update like it was years ago.
1 parent 92d0f2f commit 1d2d4b2

File tree

1 file changed

+7
-3
lines changed
  • native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox

1 file changed

+7
-3
lines changed

native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/FrameworkTest.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunCheck
1818
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunChecks
1919
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.*
2020
import org.jetbrains.kotlin.konan.test.blackbox.support.util.createTestProvider
21+
import org.jetbrains.kotlin.native.executors.RunProcessException
2122
import org.jetbrains.kotlin.native.executors.runProcess
2223
import org.jetbrains.kotlin.test.KotlinTestUtils.assertEqualsToFile
2324
import org.jetbrains.kotlin.test.KtAssert.fail
@@ -550,9 +551,12 @@ abstract class FrameworkTestBase : AbstractNativeSimpleTest() {
550551
val expectedLazyHeaderName = "expectedLazy/expectedLazy${suffix}.h"
551552
val expectedLazyHeader = objcExportTestSuiteDir.resolve(expectedLazyHeaderName)
552553
if (!expectedLazyHeader.exists() || expectedLazyHeader.readLines() != lazyHeader.readLines()) {
553-
runProcess("diff", "-u", expectedLazyHeader.absolutePath, lazyHeader.absolutePath)
554-
lazyHeader.copyTo(expectedLazyHeader, overwrite = true)
555-
fail("$expectedLazyHeader file patched;\nPlease review this change and commit the patch, if change is correct")
554+
try {
555+
runProcess("diff", "-u", expectedLazyHeader.absolutePath, lazyHeader.absolutePath)
556+
} catch (_: RunProcessException) {
557+
lazyHeader.copyTo(expectedLazyHeader, overwrite = true)
558+
fail("$expectedLazyHeader file patched;\nPlease review this change and commit the patch, if change is correct")
559+
}
556560
}
557561
}
558562
}

0 commit comments

Comments
 (0)