[K/N][tests] Allow specifying program args in new test infra ^KT-61259
This commit is contained in:
committed by
Space Team
parent
f46a14522f
commit
0ab0607bbf
+10
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.INPUT_DAT
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.KIND
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.LLDB_TRACE
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.OUTPUT_DATA_FILE
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.PROGRAM_ARGS
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.TEST_RUNNER
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunCheck
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunCheck.OutputDataFile
|
||||
@@ -181,6 +182,13 @@ internal object TestDirectives : SimpleDirectivesContainer() {
|
||||
Declares this test is expected to fail in described run configuration on K2 frontend.
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
val PROGRAM_ARGS by stringDirective(
|
||||
description = """
|
||||
Command line arguments to pass to the executable.
|
||||
Note that this directive makes sense only in combination with // KIND: STANDALONE_NO_TR
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
internal enum class TestKind {
|
||||
@@ -386,6 +394,8 @@ private fun parseFileBasedDirective(
|
||||
return file
|
||||
}
|
||||
|
||||
internal fun parseProgramArguments(registeredDirectives: RegisteredDirectives): List<String> = registeredDirectives[PROGRAM_ARGS]
|
||||
|
||||
internal class Location(private val testDataFile: File, val lineNumber: Int? = null) {
|
||||
override fun toString() = buildString {
|
||||
append(testDataFile.path)
|
||||
|
||||
+2
-1
@@ -230,7 +230,8 @@ internal class StandardTestCaseGroupProvider : TestCaseGroupProvider {
|
||||
TestKind.STANDALONE_NO_TR -> {
|
||||
NoTestRunnerExtras(
|
||||
entryPoint = parseEntryPoint(registeredDirectives, location),
|
||||
inputDataFile = parseInputDataFile(baseDir = testDataFile.parentFile, registeredDirectives, location)
|
||||
inputDataFile = parseInputDataFile(baseDir = testDataFile.parentFile, registeredDirectives, location),
|
||||
arguments = parseProgramArguments(registeredDirectives)
|
||||
)
|
||||
}
|
||||
TestKind.REGULAR, TestKind.STANDALONE -> {
|
||||
|
||||
+3
-1
@@ -37,7 +37,9 @@ internal open class BaseTestRunProvider {
|
||||
}
|
||||
TestKind.STANDALONE_NO_TR -> {
|
||||
assertTrue(testName == null)
|
||||
addIfNotNull(testCase.extras<NoTestRunnerExtras>().inputDataFile?.let(TestRunParameter::WithInputData))
|
||||
val extras = testCase.extras<NoTestRunnerExtras>()
|
||||
addIfNotNull(extras.inputDataFile?.let(TestRunParameter::WithInputData))
|
||||
add(TestRunParameter.WithFreeCommandLineArguments(extras.arguments))
|
||||
}
|
||||
TestKind.STANDALONE -> {
|
||||
add(TestRunParameter.WithTCTestLogger)
|
||||
|
||||
Reference in New Issue
Block a user