Read process streams to avoid hanging on Windows in parcelize tests

Could be reproduced with ParcelizeBoxTestGenerated.testKt36658 test.
This commit is contained in:
Nikolay Krasko
2021-05-11 16:27:50 +03:00
committed by TeamCityServer
parent 818bbbbb83
commit f30980806f
2 changed files with 13 additions and 3 deletions
@@ -166,10 +166,15 @@ abstract class AbstractParcelBoxTest : CodegenTestCase() {
JUNIT_GENERATED_TEST_CLASS_FQNAME
).start()
val out = process.inputStream.bufferedReader().lineSequence().joinToString("\n")
val err = process.errorStream.bufferedReader().lineSequence().joinToString("\n")
process.waitFor(3, TimeUnit.MINUTES)
println(process.inputStream.bufferedReader().lineSequence().joinToString("\n"))
if (process.exitValue() != 0) {
println(process.inputStream.bufferedReader().lineSequence().joinToString("\n"))
println(out)
println(err)
throw AssertionError("Process exited with exit code ${process.exitValue()} \n" + classFileFactory.createText())
}
} finally {
@@ -163,9 +163,14 @@ abstract class AbstractParcelizeBoxTest : CodegenTestCase() {
JUNIT_GENERATED_TEST_CLASS_FQNAME
).start()
val out = process.inputStream.bufferedReader().lineSequence().joinToString("\n")
val err = process.errorStream.bufferedReader().lineSequence().joinToString("\n")
process.waitFor(3, TimeUnit.MINUTES)
if (process.exitValue() != 0) {
println(process.inputStream.bufferedReader().lineSequence().joinToString("\n"))
println(out)
println(err)
throw AssertionError("Process exited with exit code ${process.exitValue()} \n" + classFileFactory.createText())
}
} finally {