[Gradle IT] Added Integration Test for checking native ic args
#KT-63742
This commit is contained in:
committed by
Space Team
parent
d2a0e1dada
commit
0b31d70ce9
+57
@@ -30,6 +30,63 @@ class NativeIncrementalCompilationIT : KGPBaseTest() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@DisplayName("KT-63742: Check that kotlinNativeLink task passes all required args for cache orchestration and ic")
|
||||||
|
@GradleTestVersions(minVersion = TestVersions.Gradle.G_7_4) // DefaultResolvedComponentResult is supported after 7.4 only
|
||||||
|
@GradleTest
|
||||||
|
fun checkArgumentsForIncrementalCache(gradleVersion: GradleVersion) {
|
||||||
|
nativeProject("native-incremental-simple", gradleVersion) {
|
||||||
|
|
||||||
|
val compilerCacheOrchestrationArgs = arrayOf(
|
||||||
|
"-Xauto-cache-from=${getGradleUserHome()}",
|
||||||
|
"-Xbackend-threads=4"
|
||||||
|
)
|
||||||
|
|
||||||
|
val incrementalCacheArgs = arrayOf(
|
||||||
|
"-Xenable-incremental-compilation",
|
||||||
|
"-Xic-cache-dir=${projectPath.resolve("build").resolve("kotlin-native-ic-cache").toFile().canonicalPath}"
|
||||||
|
)
|
||||||
|
|
||||||
|
// disabled incremental cache parameter
|
||||||
|
val withoutIncrementalCacheBuildOptions = defaultBuildOptions.copy(
|
||||||
|
nativeOptions = defaultBuildOptions.nativeOptions.copy(
|
||||||
|
incremental = false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
build("linkDebugExecutableHost", buildOptions = withoutIncrementalCacheBuildOptions) {
|
||||||
|
extractNativeTasksCommandLineArgumentsFromOutput(":linkDebugExecutableHost") {
|
||||||
|
assertCommandLineArgumentsContain(*compilerCacheOrchestrationArgs)
|
||||||
|
assertCommandLineArgumentsDoNotContain(*incrementalCacheArgs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// enabled incremental cache parameter
|
||||||
|
val withIncrementalCacheBuildOptions = defaultBuildOptions.copy(
|
||||||
|
nativeOptions = defaultBuildOptions.nativeOptions.copy(
|
||||||
|
incremental = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
build("clean", "linkDebugExecutableHost", buildOptions = withIncrementalCacheBuildOptions) {
|
||||||
|
extractNativeTasksCommandLineArgumentsFromOutput(":linkDebugExecutableHost") {
|
||||||
|
assertCommandLineArgumentsContain(*(compilerCacheOrchestrationArgs + incrementalCacheArgs))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// enabled incremental cache and configuration cache parameters
|
||||||
|
val withIncrementalCacheAndConfigurationCacheBuildOptions = defaultBuildOptions.copy(
|
||||||
|
configurationCache = true,
|
||||||
|
nativeOptions = defaultBuildOptions.nativeOptions.copy(
|
||||||
|
incremental = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
build("clean", "linkDebugExecutableHost", buildOptions = withIncrementalCacheAndConfigurationCacheBuildOptions) {
|
||||||
|
extractNativeTasksCommandLineArgumentsFromOutput(":linkDebugExecutableHost") {
|
||||||
|
assertCommandLineArgumentsContain(*(compilerCacheOrchestrationArgs + incrementalCacheArgs))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@DisplayName("Smoke test")
|
@DisplayName("Smoke test")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun checkIncrementalCacheIsCreated(gradleVersion: GradleVersion) {
|
fun checkIncrementalCacheIsCreated(gradleVersion: GradleVersion) {
|
||||||
|
|||||||
+5
-1
@@ -222,6 +222,10 @@ fun TestProject.buildAndFail(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getGradleUserHome(): File {
|
||||||
|
return testKitDir.toAbsolutePath().toFile().canonicalFile
|
||||||
|
}
|
||||||
|
|
||||||
private fun BuildResult.additionalAssertions(buildOptions: BuildOptions) {
|
private fun BuildResult.additionalAssertions(buildOptions: BuildOptions) {
|
||||||
if (buildOptions.warningMode != WarningMode.Fail) {
|
if (buildOptions.warningMode != WarningMode.Fail) {
|
||||||
assertDeprecationWarningsArePresent(buildOptions.warningMode)
|
assertDeprecationWarningsArePresent(buildOptions.warningMode)
|
||||||
@@ -251,7 +255,7 @@ internal inline fun <reified T> TestProject.getModels(
|
|||||||
|
|
||||||
val connector = GradleConnector
|
val connector = GradleConnector
|
||||||
.newConnector()
|
.newConnector()
|
||||||
.useGradleUserHomeDir(testKitDir.toAbsolutePath().toFile())
|
.useGradleUserHomeDir(getGradleUserHome())
|
||||||
.useGradleVersion(gradleVersion.version)
|
.useGradleVersion(gradleVersion.version)
|
||||||
.forProjectDirectory(projectPath.toAbsolutePath().toFile())
|
.forProjectDirectory(projectPath.toAbsolutePath().toFile())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user