[Test] Add directive which allows to attach debugger to instance of JVM in box test

This commit is contained in:
Dmitriy Novozhilov
2021-07-15 18:11:45 +03:00
committed by teamcityserver
parent 1fa74ef939
commit 972211f8e6
2 changed files with 15 additions and 0 deletions
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.test.clientserver.TestProxy
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.ATTACH_DEBUGGER
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.ENABLE_JVM_PREVIEW
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
@@ -202,6 +203,7 @@ class JvmBoxRunner(testServices: TestServices) : JvmBinaryArtifactHandler(testSe
val command = listOfNotNull(
javaExe.absolutePath,
runIf(ATTACH_DEBUGGER in module.directives) { "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" },
"-ea",
runIf(ENABLE_JVM_PREVIEW in module.directives) { "--enable-preview" },
"-classpath",
@@ -151,4 +151,17 @@ object CodegenTestDirectives : SimpleDirectivesContainer() {
structure of test
""".trimIndent()
)
val ATTACH_DEBUGGER by directive(
description = """
This directive can be used to attach debugger to instance of JVM which
is used to run `box` test in case it runs in separate JVM instance
(e.g. when this case should be ran on some modern JDK like JDK 17)
After running test run remote debugger on port 5005 (test will wait until
debugger won't be attached)
Please don't forget to remove this directive after debug session is over
""".trimIndent()
)
}