[K/N][tests] Migrate entry point runtime tests to new testing infra ^KT-61259

This commit is contained in:
Alexander Shabalin
2023-11-06 18:59:35 +01:00
committed by Space Team
parent 0ab0607bbf
commit 340103098f
26 changed files with 199 additions and 135 deletions
@@ -622,36 +622,6 @@ standaloneTest('enumEquals') {
flags = ['-XXLanguage:-ProhibitComparisonOfIncompatibleEnums', '-e', 'runtime.basic.enum_equals.main']
}
standaloneTest("entry0") {
useGoldenData = true
source = "runtime/basic/entry0.kt"
flags = ["-entry", "runtime.basic.entry0.main"]
}
standaloneTest("entry1") {
useGoldenData = true
source = "runtime/basic/entry1.kt"
flags = ["-entry", "foo"]
}
linkTest("entry2") {
useGoldenData = true
source = "runtime/basic/entry2.kt"
lib = "runtime/basic/libentry2.kt"
flags = ["-entry", "foo"]
}
standaloneTest("entry3") {
useGoldenData = true
source = "runtime/basic/entry3.kt"
flags = ["-entry", "bar"]
}
standaloneTest("entry4") {
useGoldenData = true
source = "runtime/basic/entry4.kt"
}
standaloneTest("cleaner_basic") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_basic.kt"
@@ -2365,12 +2335,6 @@ tasks.register("break1", KonanLocalTest) {
source = "codegen/controlflow/break1.kt"
}
standaloneTest("args0") {
arguments = ["AAA", "BB", "C"]
useGoldenData = true
source = "runtime/basic/args0.kt"
}
standaloneTest("devirtualization_lateinitInterface") {
disabled = (cacheTesting != null) // Cache is not compatible with -opt.
useGoldenData = true
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
fun main(args : Array<String>) {
for (s in args) {
println(s)
}
}
@@ -1,3 +0,0 @@
AAA
BB
C
@@ -1 +0,0 @@
Hello.
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
fun fail() {
println("Test failed, this is a wrong main() function.")
}
fun foo(args: Array<String>) {
println("Hello.")
}
fun bar() {
println("Hello, without args.")
}
fun main(args: Array<String>) {
fail()
}
@@ -1 +0,0 @@
Hello.
@@ -1,9 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
fun main(args: Array<String>) {
fail()
}
@@ -1 +0,0 @@
Hello.
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
fun fail() {
println("Test failed, this is a wrong main() function.")
}
fun foo(args: Array<String>) {
println("Hello.")
}
fun bar() {
println("Hello, without args.")
}
fun main(args: Array<String>) {
fail()
}
@@ -1 +0,0 @@
Hello, without args.
@@ -1,3 +0,0 @@
fun main() {
println("This is main without args")
}
@@ -1 +0,0 @@
This is main without args
@@ -1,13 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
fun fail() {
println("Test failed, this is a wrong main() function.")
}
fun foo(args: Array<String>) {
println("Hello.")
}
@@ -0,0 +1,7 @@
// PROGRAM_ARGS: AAA BB C
import kotlin.test.*
fun main(args: Array<String>) {
assertContentEquals(arrayOf("AAA", "BB", "C"), args)
}
@@ -0,0 +1,20 @@
// OUTPUT_DATA_FILE: differentEntry.out
// ENTRY_POINT: foo
import kotlin.test.*
fun foo() {
fail()
}
fun foo(args: Array<String>) {
println("OK")
}
fun bar() {
fail()
}
fun main(args: Array<String>) {
fail()
}
@@ -0,0 +1 @@
OK
@@ -0,0 +1,18 @@
// OUTPUT_DATA_FILE: differentEntryMultiModule.out
// ENTRY_POINT: foo
// MODULE: lib
// FILE: lib.kt
fun foo(args: Array<String>) {
println("OK")
}
// MODULE: program(lib)
// FILE: main.kt
import kotlin.test.*
fun main(args: Array<String>) {
fail()
}
@@ -0,0 +1,20 @@
// OUTPUT_DATA_FILE: differentEntry.out
// ENTRY_POINT: foo
import kotlin.test.*
fun foo() {
println("OK")
}
fun foo(args: Array<Int>) {
fail()
}
fun bar() {
fail()
}
fun main(args: Array<String>) {
fail()
}
@@ -0,0 +1 @@
OK
@@ -1,13 +1,6 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// OUTPUT_DATA_FILE: mainOverloading.out
package runtime.basic.entry0
fun fail() {
println("Test failed, this is a wrong main() function.")
}
import kotlin.test.*
fun main() {
fail()
@@ -32,6 +25,5 @@ class Foo {
}
fun main(args: Array<String>) {
println("Hello.")
}
println("OK")
}
@@ -0,0 +1 @@
OK
@@ -0,0 +1,25 @@
// OUTPUT_DATA_FILE: mainOverloading.out
import kotlin.test.*
fun main() {
println("OK")
}
fun <T> main(args: Array<String>) {
fail()
}
fun main(args: Array<Int>) {
fail()
}
fun main(args: Array<String>, second_arg: Int) {
fail()
}
class Foo {
fun main(args: Array<String>) {
fail()
}
}
@@ -0,0 +1 @@
OK
@@ -90,4 +90,55 @@ public class FirNativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest
runTest("native/native.tests/testData/standalone/console/readlnOrNullEmpty.kt");
}
}
@Nested
@TestMetadata("native/native.tests/testData/standalone/entryPoint")
@TestDataPath("$PROJECT_ROOT")
@Tag("standalone")
@EnforcedProperty(property = ClassLevelProperty.TEST_KIND, propertyValue = "STANDALONE_NO_TR")
@UseStandardTestCaseGroupProvider()
@Tag("frontend-fir")
@FirPipeline()
public class EntryPoint {
@Test
public void testAllFilesPresentInEntryPoint() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone/entryPoint"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("args.kt")
public void testArgs() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/args.kt");
}
@Test
@TestMetadata("differentEntry.kt")
public void testDifferentEntry() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/differentEntry.kt");
}
@Test
@TestMetadata("differentEntryMultiModule.kt")
public void testDifferentEntryMultiModule() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/differentEntryMultiModule.kt");
}
@Test
@TestMetadata("differentEntryNoArgs.kt")
public void testDifferentEntryNoArgs() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/differentEntryNoArgs.kt");
}
@Test
@TestMetadata("mainOverloading.kt")
public void testMainOverloading() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/mainOverloading.kt");
}
@Test
@TestMetadata("mainOverloadingNoArgs.kt")
public void testMainOverloadingNoArgs() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/mainOverloadingNoArgs.kt");
}
}
}
@@ -85,4 +85,53 @@ public class NativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest {
runTest("native/native.tests/testData/standalone/console/readlnOrNullEmpty.kt");
}
}
@Nested
@TestMetadata("native/native.tests/testData/standalone/entryPoint")
@TestDataPath("$PROJECT_ROOT")
@Tag("standalone")
@EnforcedProperty(property = ClassLevelProperty.TEST_KIND, propertyValue = "STANDALONE_NO_TR")
@UseStandardTestCaseGroupProvider()
public class EntryPoint {
@Test
public void testAllFilesPresentInEntryPoint() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone/entryPoint"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("args.kt")
public void testArgs() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/args.kt");
}
@Test
@TestMetadata("differentEntry.kt")
public void testDifferentEntry() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/differentEntry.kt");
}
@Test
@TestMetadata("differentEntryMultiModule.kt")
public void testDifferentEntryMultiModule() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/differentEntryMultiModule.kt");
}
@Test
@TestMetadata("differentEntryNoArgs.kt")
public void testDifferentEntryNoArgs() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/differentEntryNoArgs.kt");
}
@Test
@TestMetadata("mainOverloading.kt")
public void testMainOverloading() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/mainOverloading.kt");
}
@Test
@TestMetadata("mainOverloadingNoArgs.kt")
public void testMainOverloadingNoArgs() throws Exception {
runTest("native/native.tests/testData/standalone/entryPoint/mainOverloadingNoArgs.kt");
}
}
}