[K/N][tests] Move some more native tests to new testing infra

^KT-61259
This commit is contained in:
Vladimir Sukharev
2024-01-03 22:35:22 +01:00
committed by Space Team
parent 4080776fe3
commit 0a0da76a56
43 changed files with 7475 additions and 7233 deletions
@@ -309,24 +309,12 @@ standaloneTest("runtime_basic_init") {
expectedExitStatus = 0
}
standaloneTest('enumEquals') {
useGoldenData = true
source = "runtime/basic/enum_equals.kt"
flags = ['-XXLanguage:-ProhibitComparisonOfIncompatibleEnums', '-e', 'runtime.basic.enum_equals.main']
}
standaloneTest("cleaner_basic") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_basic.kt"
flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
}
standaloneTest("collect_reference_field_values") {
enabled = !isNoopGC
source = "runtime/basic/collectReferenceFieldValues.kt"
flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
}
standaloneTest("cleaner_workers") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_workers.kt"
@@ -576,20 +564,6 @@ tasks.register("vtable_any", KonanLocalTest) {
useGoldenData = true
}
tasks.register("strdedup1", KonanLocalTest) {
useGoldenData = true
source = "datagen/literals/strdedup1.kt"
}
tasks.register("strdedup2", KonanLocalTest) {
// TODO: string deduplication across several components seems to require
// linking them as bitcode modules before translating to machine code.
enabled = false
useGoldenData = true
source = "datagen/literals/strdedup2.kt"
}
tasks.register("empty_string", KonanLocalTest) {
useGoldenData = true
source = "datagen/literals/empty_string.kt"
@@ -608,47 +582,6 @@ linkTest("no_purge_for_dependencies") {
UtilsKt.dependsOnPlatformLibs(it)
}
tasks.register("throw0", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/throw0.kt"
}
tasks.register("statements0", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/statements0.kt"
}
tasks.register("interface0", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/interface0.kt"
}
tasks.register("listof1", KonanLocalTest) {
enabled = false
useGoldenData = true
source = "datagen/literals/listof1.kt"
}
tasks.register("catch1", KonanLocalTest) {
useGoldenData = true
source = "runtime/exceptions/catch1.kt"
}
tasks.register("catch2", KonanLocalTest) {
useGoldenData = true
source = "runtime/exceptions/catch2.kt"
}
tasks.register("catch7", KonanLocalTest) {
useGoldenData = true
source = "runtime/exceptions/catch7.kt"
}
tasks.register("extend_exception", KonanLocalTest) {
useGoldenData = true
source = "runtime/exceptions/extend0.kt"
}
standaloneTest("check_stacktrace_format_coresymbolication") {
disabled = !PlatformInfo.supportsCoreSymbolication(project) || project.globalTestArgs.contains('-opt')
flags = ['-g', '-Xbinary=sourceInfoType=coresymbolication']
@@ -708,60 +641,10 @@ standaloneTest("throw_from_except_constr") {
source = "runtime/exceptions/throw_from_except_constr.kt"
}
tasks.register("rethrow_exception", KonanLocalTest) {
source = "runtime/exceptions/rethrow.kt"
}
tasks.register("throw_from_catch", KonanLocalTest) {
source = "runtime/exceptions/throw_from_catch.kt"
}
tasks.register("initializers0", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/initializers0.kt"
}
tasks.register("initializers1", KonanLocalTest) {
useGoldenData = true
enabled = false
source = "runtime/basic/initializers1.kt"
}
standaloneTest("initializers2") {
useGoldenData = true
source = "runtime/basic/initializers2.kt"
}
tasks.register("initializers3", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/initializers3.kt"
}
tasks.register("initializers4", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/initializers4.kt"
}
tasks.register("initializers5", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/initializers5.kt"
}
tasks.register("initializers6", KonanLocalTest) {
source = "runtime/basic/initializers6.kt"
}
tasks.register("initializers7", KonanLocalTest) {
source = "runtime/basic/initializers7.kt"
}
tasks.register("initializers8", KonanLocalTest) {
source = "runtime/basic/initializers8.kt"
}
tasks.register("memory_var1", KonanLocalTest) {
source = "runtime/memory/var1.kt"
}
@@ -1,2 +0,0 @@
true
[a, b, c]
@@ -1,2 +0,0 @@
true
true
@@ -1,2 +0,0 @@
true
true
@@ -1,3 +0,0 @@
true
false
false
@@ -1,10 +0,0 @@
main
B::constructor(1)
A::companion
A::companion::foo
A::companion::foo
B::constructor(0)
B::constructor()
A::Obj
A::AObj::foo
A::AObj::foo
@@ -1,2 +0,0 @@
Init Test
Done
@@ -1,5 +0,0 @@
init globalValue2
init globalValue3
1
globalValue2
globalValue3
@@ -1,2 +0,0 @@
1073741824
true
@@ -1 +0,0 @@
PASSED
@@ -1,4 +0,0 @@
239
238
30
29
@@ -1 +0,0 @@
Done
@@ -1,3 +0,0 @@
Before
Caught Throwable
Done
@@ -1,3 +0,0 @@
Before
Caught Error
Done
@@ -1 +0,0 @@
Error happens
@@ -1 +0,0 @@
OK
@@ -2,6 +2,10 @@
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// Ideally, this test must fail with gcType=NOOP with any cache mode.
// KT-63944: unfortunately, GC flavours are silently not switched in presence of caches.
// As soon the issue would be fixed, please remove `&& cacheMode=NO` from next line.
// IGNORE_NATIVE: gcType=NOOP && cacheMode=NO
import kotlin.native.internal.*
import kotlin.test.*
@@ -35,7 +39,6 @@ class X(
lateinit var r: IntArray
}
@Test
fun `big class with mixed values`() {
val lst = listOf(1, 2, 3)
val ia = intArrayOf(1, 2, 3)
@@ -70,42 +73,48 @@ fun `big class with mixed values`() {
assertContains(fields, BoxInt(5))
assertContains(fields, BoxA(a6))}
@Test
fun `call on primitive`() {
assertEquals(1.collectReferenceFieldValues(), emptyList<Any>())
assertEquals(123456.collectReferenceFieldValues(), emptyList<Any>())
}
@Test
fun `call on value over primitive class`() {
assertEquals(BoxInt(1).collectReferenceFieldValues(), emptyList<Any>())
assertEquals(BoxBoxInt(BoxInt(1)).collectReferenceFieldValues(), emptyList<Any>())
}
@Test
fun `call on value class`() {
val a1 = A(1)
assertEquals(BoxA(a1).collectReferenceFieldValues(), listOf(a1))
assertEquals(BoxBoxA(BoxA(a1)).collectReferenceFieldValues(), listOf(a1))
}
@Test
fun `call on String`() {
assertEquals("1234".collectReferenceFieldValues(), emptyList<Any>())
assertEquals("".collectReferenceFieldValues(), emptyList<Any>())
}
@Test
fun `call on primitive array`() {
assertEquals(intArrayOf(1, 2, 3).collectReferenceFieldValues(), emptyList<Any>())
assertEquals(intArrayOf().collectReferenceFieldValues(), emptyList<Any>())
}
@Test
fun `call on array`() {
assertEquals(arrayOf(1, 2, 3).collectReferenceFieldValues(), listOf<Any>(1, 2, 3))
assertEquals(arrayOf(null, "10", null, 3).collectReferenceFieldValues(), listOf<Any>("10", 3))
assertEquals(arrayOf<Any>().collectReferenceFieldValues(), emptyList<Any>())
assertEquals(emptyArray<Any>().collectReferenceFieldValues(), emptyList<Any>())
assertEquals(emptyArray<Any?>().collectReferenceFieldValues(), emptyList<Any>())
}
}
fun box(): String {
`big class with mixed values`()
`call on value over primitive class`()
`call on primitive`()
`call on array`()
`call on String`()
`call on value class`()
`call on primitive array`()
return "OK"
}
@@ -38,6 +38,8 @@ fun main() {
)
) {
model("codegen", targetBackend = TargetBackend.NATIVE)
model("datagen", targetBackend = TargetBackend.NATIVE)
model("runtime", targetBackend = TargetBackend.NATIVE)
}
testClass<AbstractNativeCodegenBoxTest>(
suiteTestClassName = "FirNativeCodegenLocalTestGenerated",
@@ -47,6 +49,8 @@ fun main() {
)
) {
model("codegen", targetBackend = TargetBackend.NATIVE)
model("datagen", targetBackend = TargetBackend.NATIVE)
model("runtime", targetBackend = TargetBackend.NATIVE)
}
}