Skip to content

Commit dd5f85a

Browse files
committed
Remove default run destination argument from build operation tests
This makes it more obvious that a test is targeting the macOS platform, and makes our test infrastructure slightly less Apple-centric by ceasing to encode an implicit assumption of a default platform.
1 parent a816d6d commit dd5f85a

File tree

56 files changed

+690
-690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+690
-690
lines changed

Sources/SWBTestSupport/BuildOperationTester.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ package final class BuildOperationTester {
13421342
}
13431343

13441344
/// Construct the build description for the given build parameters, and check it.
1345-
@discardableResult package func checkBuildDescription<T>(_ parameters: BuildParameters? = nil, runDestination: SWBProtocol.RunDestinationInfo? = .macOS, buildRequest inputBuildRequest: BuildRequest? = nil, buildCommand: BuildCommand? = nil, schemeCommand: SchemeCommand? = .launch, persistent: Bool = false, serial: Bool = false, signableTargets: Set<String> = [], signableTargetInputs: [String: ProvisioningTaskInputs] = [:], clientDelegate: (any ClientDelegate)? = nil, workspaceContext: WorkspaceContext? = nil, sourceLocation: SourceLocation = #_sourceLocation, body: (BuildDescriptionResults) async throws -> T) async throws -> T {
1345+
@discardableResult package func checkBuildDescription<T>(_ parameters: BuildParameters? = nil, runDestination: SWBProtocol.RunDestinationInfo?, buildRequest inputBuildRequest: BuildRequest? = nil, buildCommand: BuildCommand? = nil, schemeCommand: SchemeCommand? = .launch, persistent: Bool = false, serial: Bool = false, signableTargets: Set<String> = [], signableTargetInputs: [String: ProvisioningTaskInputs] = [:], clientDelegate: (any ClientDelegate)? = nil, workspaceContext: WorkspaceContext? = nil, sourceLocation: SourceLocation = #_sourceLocation, body: (BuildDescriptionResults) async throws -> T) async throws -> T {
13461346
let parameters = effectiveBuildParameters(parameters, runDestination: runDestination)
13471347

13481348
let clientDelegate = clientDelegate ?? self.clientDelegate
@@ -1422,12 +1422,12 @@ package final class BuildOperationTester {
14221422
}
14231423

14241424
/// Construct the tasks for the given build parameters, and test the result.
1425-
@discardableResult package func checkBuild<T>(_ name: String? = nil, parameters: BuildParameters? = nil, runDestination: SWBProtocol.RunDestinationInfo? = .macOS, buildRequest inputBuildRequest: BuildRequest? = nil, buildCommand: BuildCommand? = nil, schemeCommand: SchemeCommand? = .launch, persistent: Bool = false, serial: Bool = false, buildOutputMap: [String:String]? = nil, signableTargets: Set<String> = [], signableTargetInputs: [String: ProvisioningTaskInputs] = [:], clientDelegate: (any ClientDelegate)? = nil, sourceLocation: SourceLocation = #_sourceLocation, body: (BuildResults) async throws -> T) async throws -> T {
1425+
@discardableResult package func checkBuild<T>(_ name: String? = nil, parameters: BuildParameters? = nil, runDestination: SWBProtocol.RunDestinationInfo?, buildRequest inputBuildRequest: BuildRequest? = nil, buildCommand: BuildCommand? = nil, schemeCommand: SchemeCommand? = .launch, persistent: Bool = false, serial: Bool = false, buildOutputMap: [String:String]? = nil, signableTargets: Set<String> = [], signableTargetInputs: [String: ProvisioningTaskInputs] = [:], clientDelegate: (any ClientDelegate)? = nil, sourceLocation: SourceLocation = #_sourceLocation, body: (BuildResults) async throws -> T) async throws -> T {
14261426
try await checkBuild(name, parameters: parameters, runDestination: runDestination, buildRequest: inputBuildRequest, buildCommand: buildCommand, schemeCommand: schemeCommand, persistent: persistent, serial: serial, buildOutputMap: buildOutputMap, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs, clientDelegate: clientDelegate, sourceLocation: sourceLocation, body: body, performBuild: { await $0.buildWithTimeout() })
14271427
}
14281428

14291429
/// Construct the tasks for the given build parameters, and test the result.
1430-
@discardableResult package func checkBuild<T>(_ name: String? = nil, parameters: BuildParameters? = nil, runDestination: RunDestinationInfo? = .macOS, buildRequest inputBuildRequest: BuildRequest? = nil, operationBuildRequest: BuildRequest? = nil, buildCommand: BuildCommand? = nil, schemeCommand: SchemeCommand? = .launch, persistent: Bool = false, serial: Bool = false, buildOutputMap: [String:String]? = nil, signableTargets: Set<String> = [], signableTargetInputs: [String: ProvisioningTaskInputs] = [:], clientDelegate: (any ClientDelegate)? = nil, sourceLocation: SourceLocation = #_sourceLocation, body: (BuildResults) async throws -> T, performBuild: @escaping (any BuildSystemOperation) async throws -> Void) async throws -> T {
1430+
@discardableResult package func checkBuild<T>(_ name: String? = nil, parameters: BuildParameters? = nil, runDestination: RunDestinationInfo?, buildRequest inputBuildRequest: BuildRequest? = nil, operationBuildRequest: BuildRequest? = nil, buildCommand: BuildCommand? = nil, schemeCommand: SchemeCommand? = .launch, persistent: Bool = false, serial: Bool = false, buildOutputMap: [String:String]? = nil, signableTargets: Set<String> = [], signableTargetInputs: [String: ProvisioningTaskInputs] = [:], clientDelegate: (any ClientDelegate)? = nil, sourceLocation: SourceLocation = #_sourceLocation, body: (BuildResults) async throws -> T, performBuild: @escaping (any BuildSystemOperation) async throws -> Void) async throws -> T {
14311431
try await checkBuildDescription(parameters, runDestination: runDestination, buildRequest: inputBuildRequest, buildCommand: buildCommand, schemeCommand: schemeCommand, persistent: persistent, serial: serial, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs, clientDelegate: clientDelegate) { results throws in
14321432
// Check that there are no duplicate task identifiers - it is a fatal error if there are, unless `continueBuildingAfterErrors` is set.
14331433
var tasksByTaskIdentifier: [TaskIdentifier: Task] = [:]
@@ -1511,7 +1511,7 @@ package final class BuildOperationTester {
15111511
}
15121512

15131513
/// Ensure that the build is a null build.
1514-
package func checkNullBuild(_ name: String? = nil, parameters: BuildParameters? = nil, runDestination: RunDestinationInfo? = .macOS, buildRequest inputBuildRequest: BuildRequest? = nil, buildCommand: BuildCommand? = nil, schemeCommand: SchemeCommand? = .launch, persistent: Bool = false, serial: Bool = false, buildOutputMap: [String:String]? = nil, signableTargets: Set<String> = [], signableTargetInputs: [String: ProvisioningTaskInputs] = [:], clientDelegate: (any ClientDelegate)? = nil, excludedTasks: Set<String> = ["ClangStatCache", "LinkAssetCatalogSignature"], diagnosticsToValidate: Set<DiagnosticKind> = [.note, .error, .warning], sourceLocation: SourceLocation = #_sourceLocation) async throws {
1514+
package func checkNullBuild(_ name: String? = nil, parameters: BuildParameters? = nil, runDestination: RunDestinationInfo?, buildRequest inputBuildRequest: BuildRequest? = nil, buildCommand: BuildCommand? = nil, schemeCommand: SchemeCommand? = .launch, persistent: Bool = false, serial: Bool = false, buildOutputMap: [String:String]? = nil, signableTargets: Set<String> = [], signableTargetInputs: [String: ProvisioningTaskInputs] = [:], clientDelegate: (any ClientDelegate)? = nil, excludedTasks: Set<String> = ["ClangStatCache", "LinkAssetCatalogSignature"], diagnosticsToValidate: Set<DiagnosticKind> = [.note, .error, .warning], sourceLocation: SourceLocation = #_sourceLocation) async throws {
15151515

15161516
func body(results: BuildResults) throws -> Void {
15171517
results.consumeTasksMatchingRuleTypes(excludedTasks)
@@ -1615,7 +1615,7 @@ package final class BuildOperationTester {
16151615
let operationParameters = buildRequest.parameters.replacing(activeRunDestination: runDestination, activeArchitecture: nil)
16161616
let operationBuildRequest = buildRequest.with(parameters: operationParameters, buildTargets: [])
16171617

1618-
return try await checkBuild(buildRequest: buildRequest, operationBuildRequest: operationBuildRequest, persistent: persistent, sourceLocation: sourceLocation, body: body, performBuild: { await $0.buildWithTimeout() })
1618+
return try await checkBuild(runDestination: nil, buildRequest: buildRequest, operationBuildRequest: operationBuildRequest, persistent: persistent, sourceLocation: sourceLocation, body: body, performBuild: { await $0.buildWithTimeout() })
16191619
}
16201620

16211621
package struct BuildGraphResult: Sendable {

Tests/SWBBuildSystemPerfTests/ClangExplicitModulesPerfTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ fileprivate struct ClangExplicitModulesPerfTests: CoreBasedTests, PerfTests {
109109
}
110110

111111
try await measure {
112-
try await tester.checkBuild(persistent: true) { results in
112+
try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in
113113
results.checkNoDiagnostics()
114114
}
115-
try await tester.checkBuild(buildCommand: BuildCommand.cleanBuildFolder(style: .regular), body: { _ in })
115+
try await tester.checkBuild(runDestination: .macOS, buildCommand: BuildCommand.cleanBuildFolder(style: .regular), body: { _ in })
116116
}
117117
}
118118
}
@@ -206,7 +206,7 @@ fileprivate struct ClangExplicitModulesPerfTests: CoreBasedTests, PerfTests {
206206
}
207207

208208
try await measure {
209-
try await tester.checkBuild(persistent: true) { results in
209+
try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in
210210
results.checkNoDiagnostics()
211211
}
212212
try tester.fs.touch(tmpDirPath.join("Test/aProject/file-\((0..<numSources).randomElement()!).m"))

Tests/SWBBuildSystemPerfTests/DependencyValidatorPerfTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ fileprivate struct DependencyValidatorPerfTests: CoreBasedTests, PerfTests {
6363
}
6464
}
6565

66-
let parameters = BuildParameters(action: .build, configuration: "Debug", activeRunDestination: .macOS)
66+
let parameters = BuildParameters(action: .build, configuration: "Debug")
6767
let buildRequest = BuildRequest(parameters: parameters, buildTargets: tester.workspace.allTargets.map { BuildRequest.BuildTargetInfo(parameters: parameters, target: $0) }, dependencyScope: .workspace, continueBuildingAfterErrors: true, useParallelTargets: false, useImplicitDependencies: true, useDryRun: false)
6868

69-
try await tester.checkBuild(parameters: parameters, buildRequest: buildRequest) { results in
69+
try await tester.checkBuild(parameters: parameters, runDestination: .macOS, buildRequest: buildRequest) { results in
7070
results.checkTasks(.matchRuleItem("SwiftDriver")) { tasks in
7171
#expect(tasks.count == targets.count)
7272
}

Tests/SWBBuildSystemPerfTests/ModulesVerifierPerfTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fileprivate struct ModulesVerifierPerfTests: CoreBasedTests, PerfTests {
9999
"ENABLE_MODULE_VERIFIER": verify ? "YES" : "NO",
100100
])
101101

102-
try await tester.checkBuild(parameters: params, serial: true) { results in
102+
try await tester.checkBuild(parameters: params, runDestination: .macOS, serial: true) { results in
103103
}
104104

105105
let filesToTouch = [srcRoot.join("PublicHeader.h"), srcRoot.join("PrivateHeader.h")]
@@ -109,7 +109,7 @@ fileprivate struct ModulesVerifierPerfTests: CoreBasedTests, PerfTests {
109109
for file in filesToTouch {
110110
try tester.fs.touch(file)
111111
}
112-
try await tester.checkBuild(parameters: params, serial: true) { results in
112+
try await tester.checkBuild(parameters: params, runDestination: .macOS, serial: true) { results in
113113
}
114114
}
115115
}

Tests/SWBBuildSystemPerfTests/SwiftDriverPerfTests.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ fileprivate struct SwiftDriverPerfTests: CoreBasedTests, PerfTests {
8989
for _ in 0..<Config.iterations {
9090

9191
do {
92-
try await tester.checkBuild(buildRequest: buildRequest, serial: true) { results in
92+
try await tester.checkBuild(runDestination: .macOS, buildRequest: buildRequest, serial: true) { results in
9393
resultsCheck(results)
9494
}
9595

9696
if clean {
97-
try await tester.checkBuild(buildCommand: BuildCommand.cleanBuildFolder(style: .regular), body: { _ in })
97+
try await tester.checkBuild(runDestination: .macOS, buildCommand: BuildCommand.cleanBuildFolder(style: .regular), body: { _ in })
9898
}
9999
} catch {
100100
Issue.record("Can't test build: \(error)")
@@ -157,13 +157,13 @@ fileprivate struct SwiftDriverPerfTests: CoreBasedTests, PerfTests {
157157
let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false)
158158
let parameters = BuildParameters(configuration: "Debug")
159159
let buildRequest = BuildRequest(parameters: parameters, buildTargets: tester.workspace.projects[0].targets.map({ BuildRequest.BuildTargetInfo(parameters: parameters, target: $0) }), dependencyScope: .workspace, continueBuildingAfterErrors: true, useParallelTargets: true, useImplicitDependencies: false, useDryRun: false)
160-
try await tester.checkBuild(buildRequest: buildRequest, persistent: true) { results in
160+
try await tester.checkBuild(runDestination: .macOS, buildRequest: buildRequest, persistent: true) { results in
161161
results.checkNoDiagnostics()
162162
}
163-
try await tester.checkNullBuild()
163+
try await tester.checkNullBuild(runDestination: .macOS)
164164
try await measure {
165165
try localFS.touch(SRCROOT.join(filenames.randomElement()))
166-
try await tester.checkBuild(buildRequest: buildRequest, persistent: true) { results in
166+
try await tester.checkBuild(runDestination: .macOS, buildRequest: buildRequest, persistent: true) { results in
167167
results.checkNoDiagnostics()
168168
}
169169
}

Tests/SWBBuildSystemTests/AppIntentsNLTrainingTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ fileprivate struct AppIntentsNLTrainingTests: CoreBasedTests {
144144
"""
145145
}
146146

147-
let parameters = BuildParameters(action: .install, configuration: "Debug", activeRunDestination: .iOS)
148-
try await tester.checkBuild(parameters: parameters) { results in
147+
let parameters = BuildParameters(action: .install, configuration: "Debug")
148+
try await tester.checkBuild(parameters: parameters, runDestination: .iOS) { results in
149149
results.checkNoErrors()
150150
}
151151
}

Tests/SWBBuildSystemTests/AppShortcutsStringsValidationTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fileprivate struct AppShortcutsStringsValidationTests: CoreBasedTests {
9191
"""
9292
}
9393

94-
try await tester.checkBuild(parameters: parameters) { results in
94+
try await tester.checkBuild(parameters: parameters, runDestination: .macOS) { results in
9595
results.checkError(.contains("Couldn't parse property list because the input data was in an invalid format"))
9696
results.checkWarning(.contains("Unable to find extract.actionsdata in '--input-data-path' directory path"))
9797
results.checkError(.contains("Command ValidateAppShortcutStringsMetadata failed."))
@@ -197,7 +197,7 @@ fileprivate struct AppShortcutsStringsValidationTests: CoreBasedTests {
197197
let metadataFolderPath = "\(SRCROOT)/build/UninstalledProducts/macosx/testTarget.bundle/Contents/Resources/Metadata.appintents"
198198

199199
// Check that there is 1 error per invalid line
200-
try await tester.checkBuild(parameters: parameters) { results in
200+
try await tester.checkBuild(parameters: parameters, runDestination: .macOS) { results in
201201
results.checkTask(.matchRuleType("ValidateAppShortcutStringsMetadata")) { task in
202202
let executableName = task.commandLine.first
203203
if let executableName,
@@ -227,7 +227,7 @@ fileprivate struct AppShortcutsStringsValidationTests: CoreBasedTests {
227227
"""
228228
}
229229

230-
try await tester.checkBuild(parameters: parameters) { results in
230+
try await tester.checkBuild(parameters: parameters, runDestination: .macOS) { results in
231231
results.checkWarning(.contains("This phrase is not used in any App Shortcut or as a Negative Phrase."))
232232
results.checkNoErrors()
233233
}

Tests/SWBBuildSystemTests/AppleScriptTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fileprivate struct AppleScriptTests: CoreBasedTests {
7878

7979
let provisioningInputs = ["App": ProvisioningTaskInputs(identityHash: "-", signedEntitlements: .plDict([:]), simulatedEntitlements: .plDict([:]))]
8080

81-
try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), signableTargets: Set(provisioningInputs.keys), signableTargetInputs: provisioningInputs) { results in
81+
try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), runDestination: .macOS, signableTargets: Set(provisioningInputs.keys), signableTargetInputs: provisioningInputs) { results in
8282
// Check that the delegate was passed build started and build ended events in the right place.
8383
results.checkCapstoneEvents()
8484
results.checkTask(.matchRuleType("CodeSign")) { _ in }

0 commit comments

Comments
 (0)