[ObjCExport][tests] Ignore AA test failures both locally and on CI

To run AA tests normally, use kif.loca gradle property.


Merge-request: KT-MR-14129
Merged-by: Alexander Shabalin <alexander.shabalin@ashabalin.me>
This commit is contained in:
Alexander Shabalin
2024-02-02 13:43:30 +00:00
committed by Space Team
parent 15d2799ed4
commit 5525a6829a
4 changed files with 9 additions and 21 deletions
@@ -6,19 +6,20 @@
package org.jetbrains.kotlin.objcexport.testUtils
import org.jetbrains.kotlin.backend.konan.testUtils.TodoAnalysisApi
import org.jetbrains.kotlin.backend.konan.testUtils.isCI
import org.junit.AssumptionViolatedException
import org.junit.jupiter.api.extension.AfterEachCallback
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler
import kotlin.jvm.optionals.getOrNull
private val kifLocal = System.getProperty("kif.local")?.toBoolean() ?: throw RuntimeException("Missing 'kif.local' System property")
internal class TodoAnalysisApiTestExecutionExceptionHandler : TestExecutionExceptionHandler, AfterEachCallback {
override fun handleTestExecutionException(context: ExtensionContext, throwable: Throwable) {
val element = context.element.getOrNull() ?: return
if (element.isAnnotationPresent(TodoAnalysisApi::class.java)) {
val message = "Test is marked as 'Todo' for Analysis Api"
if (isCI) {
if (!kifLocal) {
throwable.printStackTrace(System.err)
throw AssumptionViolatedException(message, throwable)
} else {
@@ -33,7 +34,7 @@ internal class TodoAnalysisApiTestExecutionExceptionHandler : TestExecutionExcep
override fun afterEach(context: ExtensionContext) {
val element = context.element.getOrNull() ?: return
if (element.isAnnotationPresent(TodoAnalysisApi::class.java) && context.executionException.getOrNull() == null) {
val report: (String) -> Unit = if (isCI) ::error else System.err::println
val report: (String) -> Unit = if (!kifLocal) ::error else System.err::println
report("Test: ${context.displayName} was marked as 'Todo' but executed successfully")
}
}