From 0463d594427d09b8cbb7383b6a8ac8d33c792cb3 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 10 Jul 2024 17:17:14 -0400 Subject: [PATCH] Add the formalized Swift Testing event stream arguments to `swift test`. This PR adds `--configuration-path`, `--event-stream-output-path`, and `--event-stream-version` to `swift test`. For more information, see the Swift Testing API proposal [here](https://github.com/apple/swift-testing/blob/main/Documentation/Proposals/0002-json-abi.md). --- Sources/Commands/SwiftTestCommand.swift | 55 ++++++++++++++++++------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/Sources/Commands/SwiftTestCommand.swift b/Sources/Commands/SwiftTestCommand.swift index 6c8befaec01..7840db4f891 100644 --- a/Sources/Commands/SwiftTestCommand.swift +++ b/Sources/Commands/SwiftTestCommand.swift @@ -80,6 +80,38 @@ struct SharedOptions: ParsableArguments { var testProduct: String? } +struct TestEventStreamOptions: ParsableArguments { + /// Legacy equivalent of ``configurationPath``. + @Option(name: .customLong("experimental-configuration-path"), + help: .private) + var experimentalConfigurationPath: AbsolutePath? + + /// Path where swift-testing's JSON configuration should be read. + @Option(name: .customLong("configuration-path"), + help: .hidden) + var configurationPath: AbsolutePath? + + /// Legacy equivalent of ``eventStreamOutputPath``. + @Option(name: .customLong("experimental-event-stream-output"), + help: .private) + var experimentalEventStreamOutputPath: AbsolutePath? + + /// Path where swift-testing's JSON output should be written. + @Option(name: .customLong("event-stream-output-path"), + help: .hidden) + var eventStreamOutputPath: AbsolutePath? + + /// Legacy equivalent of ``eventStreamVersion``. + @Option(name: .customLong("experimental-event-stream-version"), + help: .private) + var experimentalEventStreamVersion: Int? + + /// The schema version of swift-testing's JSON input/output. + @Option(name: .customLong("event-stream-version"), + help: .hidden) + var eventStreamVersion: Int? +} + struct TestCommandOptions: ParsableArguments { @OptionGroup() var globalOptions: GlobalOptions @@ -91,6 +123,10 @@ struct TestCommandOptions: ParsableArguments { @OptionGroup() var testLibraryOptions: TestLibraryOptions + /// Options for Swift Testing's event stream. + @OptionGroup() + var testEventStreamOptions: TestEventStreamOptions + /// If tests should run in parallel mode. @Flag(name: .customLong("parallel"), inversion: .prefixedNo, @@ -156,21 +192,6 @@ struct TestCommandOptions: ParsableArguments { return testOutput == .experimentalSummary } - /// Path where swift-testing's JSON configuration should be read. - @Option(name: .customLong("experimental-configuration-path"), - help: .hidden) - var configurationPath: AbsolutePath? - - /// Path where swift-testing's JSON output should be written. - @Option(name: .customLong("experimental-event-stream-output"), - help: .hidden) - var eventStreamOutputPath: AbsolutePath? - - /// The schema version of swift-testing's JSON input/output. - @Option(name: .customLong("experimental-event-stream-version"), - help: .hidden) - var eventStreamVersion: Int? - @OptionGroup(visibility: .hidden) package var traits: TraitOptions } @@ -656,6 +677,10 @@ extension SwiftTestCommand { @OptionGroup() var testLibraryOptions: TestLibraryOptions + /// Options for Swift Testing's event stream. + @OptionGroup() + var testEventStreamOptions: TestEventStreamOptions + @OptionGroup(visibility: .hidden) package var traits: TraitOptions