[K/N][tests] Support setting GC scheduler in the new infra
This commit is contained in:
@@ -53,6 +53,7 @@ enum class TestProperty(shortName: String) {
|
||||
MEMORY_MODEL("memoryModel"),
|
||||
USE_THREAD_STATE_CHECKER("useThreadStateChecker"),
|
||||
GC_TYPE("gcType"),
|
||||
GC_SCHEDULER("gcScheduler"),
|
||||
USE_CACHE("useCache"), // TODO: legacy, need to remove it
|
||||
CACHE_MODE("cacheMode"),
|
||||
EXECUTION_TIMEOUT("executionTimeout");
|
||||
@@ -119,6 +120,7 @@ fun nativeTest(taskName: String, vararg tags: String) = projectTest(taskName, jU
|
||||
TestProperty.MEMORY_MODEL.setUpFromGradleProperty(this)
|
||||
TestProperty.USE_THREAD_STATE_CHECKER.setUpFromGradleProperty(this)
|
||||
TestProperty.GC_TYPE.setUpFromGradleProperty(this)
|
||||
TestProperty.GC_SCHEDULER.setUpFromGradleProperty(this)
|
||||
TestProperty.USE_CACHE.setUpFromGradleProperty(this)
|
||||
TestProperty.CACHE_MODE.setUpFromGradleProperty(this)
|
||||
TestProperty.EXECUTION_TIMEOUT.setUpFromGradleProperty(this)
|
||||
|
||||
+1
@@ -38,6 +38,7 @@ internal enum class ClassLevelProperty(shortName: String) {
|
||||
MEMORY_MODEL("memoryModel"),
|
||||
USE_THREAD_STATE_CHECKER("useThreadStateChecker"),
|
||||
GC_TYPE("gcType"),
|
||||
GC_SCHEDULER("gcScheduler"),
|
||||
CACHE_MODE("cacheMode"),
|
||||
EXECUTION_TIMEOUT("executionTimeout");
|
||||
|
||||
|
||||
+11
@@ -132,6 +132,13 @@ private object NativeTestSupport {
|
||||
}
|
||||
}
|
||||
|
||||
val gcScheduler = computeGCScheduler(enforcedProperties)
|
||||
if (gcScheduler != GCScheduler.UNSPECIFIED) {
|
||||
assertEquals(MemoryModel.EXPERIMENTAL, memoryModel) {
|
||||
"GC scheduler can be specified only with experimental memory model"
|
||||
}
|
||||
}
|
||||
|
||||
val nativeHome = getOrCreateTestProcessSettings().get<KotlinNativeHome>()
|
||||
|
||||
val hostManager = HostManager(distribution = Distribution(nativeHome.dir.path), experimental = false)
|
||||
@@ -141,6 +148,7 @@ private object NativeTestSupport {
|
||||
output += memoryModel
|
||||
output += threadStateChecker
|
||||
output += gcType
|
||||
output += gcScheduler
|
||||
output += nativeTargets
|
||||
output += CacheMode::class to computeCacheMode(enforcedProperties, nativeHome, nativeTargets, optimizationMode)
|
||||
output += computeTestMode(enforcedProperties)
|
||||
@@ -168,6 +176,9 @@ private object NativeTestSupport {
|
||||
private fun computeGCType(enforcedProperties: EnforcedProperties): GCType =
|
||||
ClassLevelProperty.GC_TYPE.readValue(enforcedProperties, GCType.values(), default = GCType.UNSPECIFIED)
|
||||
|
||||
private fun computeGCScheduler(enforcedProperties: EnforcedProperties): GCScheduler =
|
||||
ClassLevelProperty.GC_SCHEDULER.readValue(enforcedProperties, GCScheduler.values(), default = GCScheduler.UNSPECIFIED)
|
||||
|
||||
private fun computeNativeTargets(enforcedProperties: EnforcedProperties, hostManager: HostManager): KotlinNativeTargets {
|
||||
val hostTarget = HostManager.host
|
||||
return KotlinNativeTargets(
|
||||
|
||||
+4
@@ -143,6 +143,7 @@ internal abstract class SourceBasedCompilation<A : TestCompilationArtifact>(
|
||||
private val memoryModel: MemoryModel,
|
||||
private val threadStateChecker: ThreadStateChecker,
|
||||
private val gcType: GCType,
|
||||
private val gcScheduler: GCScheduler,
|
||||
freeCompilerArgs: TestCompilerArgs,
|
||||
override val sourceModules: Collection<TestModule>,
|
||||
dependencies: Iterable<TestCompilationDependency<*>>,
|
||||
@@ -161,6 +162,7 @@ internal abstract class SourceBasedCompilation<A : TestCompilationArtifact>(
|
||||
memoryModel.compilerFlags?.let { compilerFlags -> add(compilerFlags) }
|
||||
threadStateChecker.compilerFlag?.let { compilerFlag -> add(compilerFlag) }
|
||||
gcType.compilerFlag?.let { compilerFlag -> add(compilerFlag) }
|
||||
gcScheduler.compilerFlag?.let { compilerFlag -> add(compilerFlag) }
|
||||
}
|
||||
|
||||
override fun applyDependencies(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) {
|
||||
@@ -192,6 +194,7 @@ internal class LibraryCompilation(
|
||||
memoryModel = settings.get(),
|
||||
threadStateChecker = settings.get(),
|
||||
gcType = settings.get(),
|
||||
gcScheduler = settings.get(),
|
||||
freeCompilerArgs = freeCompilerArgs,
|
||||
sourceModules = sourceModules,
|
||||
dependencies = dependencies,
|
||||
@@ -221,6 +224,7 @@ internal class ExecutableCompilation(
|
||||
memoryModel = settings.get(),
|
||||
threadStateChecker = settings.get(),
|
||||
gcType = settings.get(),
|
||||
gcScheduler = settings.get(),
|
||||
freeCompilerArgs = freeCompilerArgs,
|
||||
sourceModules = sourceModules,
|
||||
dependencies = dependencies,
|
||||
|
||||
+10
@@ -93,6 +93,16 @@ internal enum class GCType(val compilerFlag: String?) {
|
||||
override fun toString() = compilerFlag?.let { "($it)" }.orEmpty()
|
||||
}
|
||||
|
||||
internal enum class GCScheduler(val compilerFlag: String?) {
|
||||
UNSPECIFIED(null),
|
||||
DISABLED("-Xbinary=gcSchedulerType=disabled"),
|
||||
WITH_TIMER("-Xbinary=gcSchedulerType=with_timer"),
|
||||
ON_SAFE_POINTS("-Xbinary=gcSchedulerType=on_safe_points"),
|
||||
AGGRESSIVE("-Xbinary=gcSchedulerType=aggressive");
|
||||
|
||||
override fun toString() = compilerFlag?.let { "($it)" }.orEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Current project's directories.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user