Put `--dir` wasmtime option before the test file path (#490)

This commit is contained in:
Yuta Saito 2024-06-21 13:38:16 +09:00 committed by GitHub
parent dca59f36ad
commit 3e08f7d793
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 5 deletions

View File

@ -33,20 +33,23 @@ struct CommandTestRunner: TestRunner {
func run() async throws {
let program = try ProcessInfo.processInfo.environment["CARTON_TEST_RUNNER"] ?? defaultWASIRuntime()
terminal.write("\nRunning the test bundle with \"\(program)\":\n", inColor: .yellow)
var arguments = [program, testFilePath.pathString]
var arguments = [program]
var xctestArgs: [String] = []
if listTestCases {
arguments.append(contentsOf: ["--", "-l"])
xctestArgs.append(contentsOf: ["--", "-l"])
} else {
let programName = (program as NSString).lastPathComponent
let programName = URL(fileURLWithPath: program).lastPathComponent
if programName == "wasmtime" {
arguments += ["--dir", "."]
}
if !testCases.isEmpty {
arguments.append("--")
arguments.append(contentsOf: testCases)
xctestArgs.append("--")
xctestArgs.append(contentsOf: testCases)
}
}
arguments += [testFilePath.pathString] + xctestArgs
try await Process.run(arguments, parser: TestsParser(), terminal)
}