Revert "[Gradle] Fix Native offline tests on Windows"

This reverts commit 118bda675f.
This commit is contained in:
Svyatoslav Scherbina
2022-06-22 09:23:31 +02:00
committed by Space
parent 487e854f60
commit b3848811e6
2 changed files with 52 additions and 65 deletions
@@ -98,13 +98,6 @@ private fun BaseGradleIT.Project.configureSingleNativeTarget(preset: String = Ho
}
}
internal fun BaseGradleIT.BuildOptions.withCustomKonanDataDir(
customKonanDataDir: File
) = this.copy(
customEnvironmentVariables = this.customEnvironmentVariables +
("KONAN_DATA_DIR" to customKonanDataDir.absolutePath)
)
class GeneralNativeIT : BaseGradleIT() {
val nativeHostTargetName = MPPNativeTargets.current
@@ -1155,32 +1148,30 @@ class GeneralNativeIT : BaseGradleIT() {
}
// Check that --offline fails when there are no downloaded dependencies:
run {
val customKonanDataDir = tempDir.newFolder()
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
val customKonanDataDir = tempDir.newFolder("konanOffline")
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.copy(
customEnvironmentVariables = buildOptionsOffline.customEnvironmentVariables +
("KONAN_DATA_DIR" to customKonanDataDir.absolutePath)
)
build("clean", linkTask, options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
assertTasksNotExecuted(listOf(linkTask))
}
checkNoDependenciesDownloaded(customKonanDataDir)
build("clean", linkTask, options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
assertTasksNotExecuted(listOf(linkTask))
}
checkNoDependenciesDownloaded(customKonanDataDir)
// Check that the compiler is not extracted if it is not cached:
run {
val customKonanDataDir = tempDir.newFolder()
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
build(
"clean", linkTask, "-Pkotlin.native.version=1.6.20-M1-9999",
options = buildOptionsOfflineWithCustomKonanDataDir
) {
assertFailed()
assertTasksNotExecuted(listOf(linkTask, compileTask))
}
assertTrue(customKonanDataDir.listFiles().isNullOrEmpty())
assertTrue(customKonanDataDir.deleteRecursively())
build(
"clean", linkTask, "-Pkotlin.native.version=1.6.20-M1-9999",
options = buildOptionsOfflineWithCustomKonanDataDir
) {
assertFailed()
assertTasksNotExecuted(listOf(linkTask, compileTask))
}
assertFalse(customKonanDataDir.exists())
}
private fun checkNoDependenciesDownloaded(customKonanDataDir: File) {
@@ -1225,32 +1216,29 @@ class GeneralNativeIT : BaseGradleIT() {
}
// Check that --offline fails when there are no downloaded dependencies:
run {
val customKonanDataDir = tempDir.newFolder()
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
val customKonanDataDir = tempDir.newFolder("konanOffline")
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.copy(
customEnvironmentVariables = buildOptionsOffline.customEnvironmentVariables +
("KONAN_DATA_DIR" to customKonanDataDir.absolutePath)
)
build("clean", cinteropTask, options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
}
checkNoDependenciesDownloaded(customKonanDataDir)
build("clean", cinteropTask, options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
}
checkNoDependenciesDownloaded(customKonanDataDir)
// Check that the compiler is not extracted if it is not cached:
run {
val customKonanDataDir = tempDir.newFolder()
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
build(
"clean", cinteropTask, "-Pkotlin.native.version=1.6.20-M1-9999",
options = buildOptionsOfflineWithCustomKonanDataDir
) {
assertFailed()
assertTasksNotExecuted(listOf(cinteropTask))
}
assertTrue(customKonanDataDir.listFiles().isNullOrEmpty())
assertTrue(customKonanDataDir.deleteRecursively())
build(
"clean", cinteropTask, "-Pkotlin.native.version=1.6.20-M1-9999",
options = buildOptionsOfflineWithCustomKonanDataDir
) {
assertFailed()
assertTasksNotExecuted(listOf(cinteropTask))
}
assertFalse(customKonanDataDir.exists())
}
@Test
@@ -342,27 +342,26 @@ class NativePlatformLibsIT : BaseGradleIT() {
}
// Check that --offline fails when there are no downloaded dependencies:
run {
val customKonanDataDir = tempDir.newFolder()
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
val customKonanDataDir = tempDir.newFolder("konanOffline")
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.copy(
customEnvironmentVariables = buildOptionsOffline.customEnvironmentVariables +
("KONAN_DATA_DIR" to customKonanDataDir.absolutePath)
)
buildWithLightDist("tasks", options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
assertContains("Generate platform libraries for linux_x64")
}
buildWithLightDist("tasks", options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
assertContains("Generate platform libraries for linux_x64")
}
// The build above have extracted the cached compiler to the custom KONAN_DATA_DIR; remove it:
run {
val customKonanDataDir = tempDir.newFolder()
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.withCustomKonanDataDir(customKonanDataDir)
// Check that the compiler is not extracted if it is not cached:
buildWithLightDist("tasks", "-Pkotlin.native.version=1.6.20-M1-9999", options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
assertNotContains("Generate platform libraries for linux_x64")
}
assertTrue(customKonanDataDir.deleteRecursively())
assertTrue(customKonanDataDir.listFiles().isNullOrEmpty())
// Check that the compiler is not extracted if it is not cached:
buildWithLightDist("tasks", "-Pkotlin.native.version=1.6.20-M1-9999", options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
assertNotContains("Generate platform libraries for linux_x64")
}
assertFalse(customKonanDataDir.exists())
}
}