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).
*/
// TODO: Support debugging.
open class KotlinNativeSimulatorTest : KotlinNativeTest() {
@Input
@Option(option = "device", description = "Sets a simulated device used to execute tests.")
lateinit var deviceId: String
@Internal
var debugMode = false
@get:Internal
override val testCommand: TestCommand = object : TestCommand() {
override val executable: String
@@ -213,7 +215,15 @@ open class KotlinNativeSimulatorTest : KotlinNativeTest() {
testNegativeGradleFilter: Set<String>,
userArgs: 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)
}
}