[Native][tests] Introduce NATIVE_STANDALONE directive

This directive makes the test standalone, i.e. disables grouping it with
other tests into a single compilation, and in particular disables
package renaming for the test.

Also, remove the old hard-coded way to mark tests standalone.
This commit is contained in:
Svyatoslav Scherbina
2022-07-28 19:03:32 +02:00
parent d50b0693b2
commit c1853a0218
2 changed files with 10 additions and 9 deletions
@@ -2,6 +2,11 @@
// IGNORE_BACKEND: WASM
// DONT_TARGET_EXACT_BACKEND: JS
// This test fails on Native with test grouping and package renaming enabled,
// because the latter doesn't yet handle annotation toString implementations properly.
// Disable test grouping as a workaround:
// NATIVE_STANDALONE
// WITH_STDLIB
// !LANGUAGE: +InstantiationOfAnnotationClasses
@@ -77,7 +77,7 @@ internal class ExtTestCaseGroupProvider : TestCaseGroupProvider, TestDisposable(
if (extTestDataFile.isRelevant)
testCases += extTestDataFile.createTestCase(
definitelyStandaloneTest = settings.get<ForcedStandaloneTestKind>().value || testDataFile in standalones,
definitelyStandaloneTest = settings.get<ForcedStandaloneTestKind>().value,
sharedModules = sharedModules
)
else
@@ -87,14 +87,6 @@ internal class ExtTestCaseGroupProvider : TestCaseGroupProvider, TestDisposable(
TestCaseGroup.Default(disabledTestCaseIds, testCases)
}
}
companion object {
/** Tests that should be compiled and executed as standalone tests. */
private val standalones: Set<File> = listOf(
// Comparison of type information obtained with reflection against non-patched string literal:
"compiler/testData/codegen/box/annotations/instances/annotationToString.kt"
).mapToSet(::getAbsoluteFile)
}
}
private class ExtTestDataFile(
@@ -176,6 +168,8 @@ private class ExtTestDataFile(
* - test is compiled independently of any other tests
*/
private fun determineIfStandaloneTest(): Boolean = with(structure) {
if (directives.contains(NATIVE_STANDALONE_DIRECTIVE)) return true
var isStandaloneTest = false
filesToTransform.forEach { handler ->
@@ -589,6 +583,8 @@ private class ExtTestDataFile(
private const val EXPECT_ACTUAL_LINKER_DIRECTIVE = "EXPECT_ACTUAL_LINKER"
private const val USE_EXPERIMENTAL_DIRECTIVE = "USE_EXPERIMENTAL"
private const val NATIVE_STANDALONE_DIRECTIVE = "NATIVE_STANDALONE"
private const val OPT_IN_DIRECTIVE = "OPT_IN"
private val OPT_INS_PURELY_FOR_COMPILER = setOf(
OptInNames.REQUIRES_OPT_IN_FQ_NAME.asString()