[Native][tests] Port KT-36639 test case to the new infra
This commit is contained in:
committed by
Space Team
parent
1c24f994db
commit
c165171471
@@ -2000,12 +2000,6 @@ dynamicTest("produce_dynamic") {
|
||||
useGoldenData = true
|
||||
}
|
||||
|
||||
dynamicTest("kt36639") {
|
||||
source = "produce_dynamic/kt-36639/main.kt"
|
||||
cSource = "$projectDir/produce_dynamic/kt-36639/main.c"
|
||||
useGoldenData = true
|
||||
}
|
||||
|
||||
dynamicTest("kt36878") {
|
||||
source = "produce_dynamic/kt-36878/hello.kt"
|
||||
cSource = "$projectDir/produce_dynamic/kt-36878/main.c"
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
#include "testlib_api.h"
|
||||
#include "kt36639_api.h"
|
||||
|
||||
#define __ testlib_symbols()->
|
||||
#define T_(x) testlib_kref_ ## x
|
||||
#define __ kt36639_symbols()->
|
||||
#define T_(x) kt36639_kref_ ## x
|
||||
|
||||
|
||||
int
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010-2024 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.test.blackbox;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/CExport")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CExportTestDynamicGenerated extends AbstractNativeCExportDynamicTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInCExport() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/CExport"), Pattern.compile("^([^_](.+))$"), null, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt36639")
|
||||
public void testKt36639() throws Exception {
|
||||
runTest("native/native.tests/testData/CExport/kt36639/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("native/native.tests/testData/CExport/smoke0/");
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010-2024 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.test.blackbox;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/CExport")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CExportTestStaticGenerated extends AbstractNativeCExportStaticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInCExport() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/CExport"), Pattern.compile("^([^_](.+))$"), null, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt36639")
|
||||
public void testKt36639() throws Exception {
|
||||
runTest("native/native.tests/testData/CExport/kt36639/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("native/native.tests/testData/CExport/smoke0/");
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2010-2024 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.test.blackbox;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.group.FirPipeline;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/CExport")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
public class FirCExportTestDynamicGenerated extends AbstractNativeCExportDynamicTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInCExport() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/CExport"), Pattern.compile("^([^_](.+))$"), null, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt36639")
|
||||
public void testKt36639() throws Exception {
|
||||
runTest("native/native.tests/testData/CExport/kt36639/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("native/native.tests/testData/CExport/smoke0/");
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2010-2024 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.test.blackbox;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.group.FirPipeline;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/CExport")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
public class FirCExportTestStaticGenerated extends AbstractNativeCExportStaticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInCExport() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/CExport"), Pattern.compile("^([^_](.+))$"), null, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt36639")
|
||||
public void testKt36639() throws Exception {
|
||||
runTest("native/native.tests/testData/CExport/kt36639/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("native/native.tests/testData/CExport/smoke0/");
|
||||
}
|
||||
}
|
||||
+8
-3
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilat
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationFactory
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationResult.Companion.assertSuccess
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestExecutable
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunCheck
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunChecks
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.Timeouts
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.configurables
|
||||
@@ -51,7 +52,11 @@ abstract class AbstractNativeCExportTest(
|
||||
.filter { it.endsWith(".c") }
|
||||
.map { testPathFull.resolve(it) }
|
||||
|
||||
val testCase = generateCExportTestCase(testPathFull, ktSources)
|
||||
val goldenData = testPathFull.list()!!
|
||||
.singleOrNull { it.endsWith(".out") }
|
||||
?.let { testPathFull.resolve(it) }
|
||||
|
||||
val testCase = generateCExportTestCase(testPathFull, ktSources, goldenData = goldenData)
|
||||
val binaryLibrary = testCompilationFactory.testCaseToBinaryLibrary(
|
||||
testCase,
|
||||
testRunSettings,
|
||||
@@ -80,7 +85,7 @@ abstract class AbstractNativeCExportTest(
|
||||
runExecutableAndVerify(testCase, testExecutable)
|
||||
}
|
||||
|
||||
private fun generateCExportTestCase(testPathFull: File, sources: List<File>): TestCase {
|
||||
private fun generateCExportTestCase(testPathFull: File, sources: List<File>, goldenData: File? = null): TestCase {
|
||||
val moduleName: String = testPathFull.name
|
||||
val module = TestModule.Exclusive(DEFAULT_MODULE_NAME, emptySet(), emptySet(), emptySet())
|
||||
sources.forEach { module.files += TestFile.createCommitted(it, module) }
|
||||
@@ -94,7 +99,7 @@ abstract class AbstractNativeCExportTest(
|
||||
checks = TestRunChecks(
|
||||
executionTimeoutCheck = TestRunCheck.ExecutionTimeout.ShouldNotExceed(testRunSettings.get<Timeouts>().executionTimeout),
|
||||
exitCodeCheck = TestRunCheck.ExitCode.Expected(0),
|
||||
outputDataFile = goldenData?.let { TestRunCheck.OutputDataFile(file = it) },
|
||||
outputDataFile = goldenData?.let { TestRunCheck.OutputDataFile(it) },
|
||||
outputMatcher = null,
|
||||
fileCheckMatcher = null,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user