Support debug in Gradle tasks responsible for K/N tests

This commit is contained in:
Kirill Shmakov
2020-03-04 11:27:22 +03:00
parent a1eff7f4af
commit 5474d5f1d3
@@ -195,12 +195,14 @@ open class KotlinNativeHostTest : KotlinNativeTest() {
/** /**
* A task running Kotlin/Native tests on a simulator (iOS/watchOS/tvOS). * A task running Kotlin/Native tests on a simulator (iOS/watchOS/tvOS).
*/ */
// TODO: Support debugging.
open class KotlinNativeSimulatorTest : KotlinNativeTest() { open class KotlinNativeSimulatorTest : KotlinNativeTest() {
@Input @Input
@Option(option = "device", description = "Sets a simulated device used to execute tests.") @Option(option = "device", description = "Sets a simulated device used to execute tests.")
lateinit var deviceId: String lateinit var deviceId: String
@Internal
var debugMode = false
@get:Internal @get:Internal
override val testCommand: TestCommand = object : TestCommand() { override val testCommand: TestCommand = object : TestCommand() {
override val executable: String override val executable: String
@@ -213,7 +215,15 @@ open class KotlinNativeSimulatorTest : KotlinNativeTest() {
testNegativeGradleFilter: Set<String>, testNegativeGradleFilter: Set<String>,
userArgs: List<String> userArgs: List<String>
): List<String> = ): List<String> =
listOf("simctl", "spawn", "--standalone", deviceId, this@KotlinNativeSimulatorTest.executable.absolutePath, "--") + listOfNotNull(
"simctl",
"spawn",
"--wait-for-debugger".takeIf { debugMode },
"--standalone",
deviceId,
this@KotlinNativeSimulatorTest.executable.absolutePath,
"--"
) +
testArgs(testLogger, checkExitCode, testGradleFilter, testNegativeGradleFilter, userArgs) testArgs(testLogger, checkExitCode, testGradleFilter, testNegativeGradleFilter, userArgs)
} }
} }