[K/N] Support compile-only mode for legacy test infra
This commit is contained in:
@@ -50,6 +50,7 @@ fun create(project: Project): ExecutorService {
|
|||||||
val configurables = project.testTargetConfigurables
|
val configurables = project.testTargetConfigurables
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
|
project.compileOnlyTests -> noopExecutor(project)
|
||||||
project.hasProperty("remote") -> sshExecutor(project, testTarget)
|
project.hasProperty("remote") -> sshExecutor(project, testTarget)
|
||||||
configurables is WasmConfigurables -> wasmExecutor(project)
|
configurables is WasmConfigurables -> wasmExecutor(project)
|
||||||
configurables is ConfigurablesWithEmulator && testTarget != HostManager.host -> emulatorExecutor(project, testTarget)
|
configurables is ConfigurablesWithEmulator && testTarget != HostManager.host -> emulatorExecutor(project, testTarget)
|
||||||
@@ -59,6 +60,19 @@ fun create(project: Project): ExecutorService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun noopExecutor(project: Project) = object : ExecutorService {
|
||||||
|
override val project: Project
|
||||||
|
get() = project
|
||||||
|
|
||||||
|
override fun execute(action: Action<in ExecSpec>): ExecResult? = object : ExecResult {
|
||||||
|
override fun getExitValue(): Int = 0
|
||||||
|
|
||||||
|
override fun assertNormalExitValue(): ExecResult = this
|
||||||
|
|
||||||
|
override fun rethrowFailure(): ExecResult = this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun wasmExecutor(project: Project) = object : ExecutorService {
|
private fun wasmExecutor(project: Project) = object : ExecutorService {
|
||||||
val absoluteTargetToolchain = project.testTargetConfigurables.absoluteTargetToolchain
|
val absoluteTargetToolchain = project.testTargetConfigurables.absoluteTargetToolchain
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,9 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
|
|||||||
// Build test executable as a first action of the task before executing the test
|
// Build test executable as a first action of the task before executing the test
|
||||||
buildTestExecutable()
|
buildTestExecutable()
|
||||||
doBeforeRun?.execute(this)
|
doBeforeRun?.execute(this)
|
||||||
|
if (project.compileOnlyTests) {
|
||||||
|
return
|
||||||
|
}
|
||||||
runTest(executorService = project.executor, testExecutable = Paths.get(executable))
|
runTest(executorService = project.executor, testExecutable = Paths.get(executable))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,9 @@ open class KonanGTest : KonanTest() {
|
|||||||
@TaskAction
|
@TaskAction
|
||||||
override fun run() {
|
override fun run() {
|
||||||
doBeforeRun?.execute(this)
|
doBeforeRun?.execute(this)
|
||||||
|
if (project.compileOnlyTests) {
|
||||||
|
return
|
||||||
|
}
|
||||||
runProcess(
|
runProcess(
|
||||||
executor = { project.executor.execute(it) },
|
executor = { project.executor.execute(it) },
|
||||||
executable = executable,
|
executable = executable,
|
||||||
@@ -302,6 +305,9 @@ open class KonanLocalTest : KonanTest() {
|
|||||||
@TaskAction
|
@TaskAction
|
||||||
override fun run() {
|
override fun run() {
|
||||||
doBeforeRun?.execute(this)
|
doBeforeRun?.execute(this)
|
||||||
|
if (project.compileOnlyTests) {
|
||||||
|
return
|
||||||
|
}
|
||||||
val times = if (multiRuns && multiArguments != null) multiArguments!!.size else 1
|
val times = if (multiRuns && multiArguments != null) multiArguments!!.size else 1
|
||||||
var output = ProcessOutput("", "", 0)
|
var output = ProcessOutput("", "", 0)
|
||||||
for (i in 1..times) {
|
for (i in 1..times) {
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ val Project.testOutputExternal
|
|||||||
val Project.cacheRedirectorEnabled
|
val Project.cacheRedirectorEnabled
|
||||||
get() = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() ?: false
|
get() = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() ?: false
|
||||||
|
|
||||||
|
val Project.compileOnlyTests: Boolean
|
||||||
|
get() = hasProperty("compile-only-tests")
|
||||||
|
|
||||||
fun Project.redirectIfEnabled(url: String):String = if (cacheRedirectorEnabled) {
|
fun Project.redirectIfEnabled(url: String):String = if (cacheRedirectorEnabled) {
|
||||||
val base = URL(url)
|
val base = URL(url)
|
||||||
"https://cache-redirector.jetbrains.com/${base.host}/${base.path}"
|
"https://cache-redirector.jetbrains.com/${base.host}/${base.path}"
|
||||||
|
|||||||
Reference in New Issue
Block a user