[tests] TestRunner: wrap exceptions from preAnalysisHandlers

Some exceptions (like contract violations) can be thrown from preAnalysisHandlers
This commit is contained in:
Dmitrii Gridin
2023-10-24 09:46:49 +02:00
committed by Space Team
parent 5a786e25c2
commit 052b9f01af
2 changed files with 9 additions and 5 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -82,7 +82,9 @@ class TestRunner(private val testConfiguration: TestConfiguration) {
}
testConfiguration.preAnalysisHandlers.forEach { preprocessor ->
preprocessor.prepareSealedClassInheritors(moduleStructure)
withAssertionCatching(WrappedException::FromPreAnalysisHandler) {
preprocessor.prepareSealedClassInheritors(moduleStructure)
}
}
for (module in modules) {
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -25,9 +25,11 @@ sealed class WrappedException(
get() = "Exception was thrown"
}
class FromMetaInfoHandler(cause: Throwable) : WrappedException(cause, 1, 1)
class FromPreAnalysisHandler(cause: Throwable) : WrappedException(cause, 1, 1)
class FromHandler(cause: Throwable, val handler: AnalysisHandler<*>) : WrappedException(cause, 1, 2) {
class FromMetaInfoHandler(cause: Throwable) : WrappedException(cause, 1, 2)
class FromHandler(cause: Throwable, val handler: AnalysisHandler<*>) : WrappedException(cause, 1, 3) {
override val failureDisablesNextSteps: Boolean
get() = handler.failureDisablesNextSteps
}