diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 4fb0f42ee2e..eeab4eb1fdc 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -2081,7 +2081,7 @@ task extend_exception(type: RunKonanTest) { } task check_stacktrace_format(type: RunStandaloneKonanTest) { - disabled = true // !isAppleTarget(project) + disabled = !isAppleTarget(project) || project.globalTestArgs.contains('-opt') flags = ['-g'] source = "runtime/exceptions/check_stacktrace_format.kt" } diff --git a/backend.native/tests/runtime/exceptions/check_stacktrace_format.kt b/backend.native/tests/runtime/exceptions/check_stacktrace_format.kt index 8fde9f81158..2f21dc84d64 100644 --- a/backend.native/tests/runtime/exceptions/check_stacktrace_format.kt +++ b/backend.native/tests/runtime/exceptions/check_stacktrace_format.kt @@ -29,15 +29,14 @@ fun functionB() { functionA() } +const val depth = 5 + fun main(args : Array) { try { functionB() } catch (e: Throwable) { val stacktrace = e.getStackTrace() - if (stacktrace.size >= 3) { - repeat(3) { - checkStringFormat(stacktrace[it]) - } - } + assert(stacktrace.size >= depth) + stacktrace.take(depth).forEach(::checkStringFormat) } }