diff --git a/Sources/Commands/Utilities/PluginDelegate.swift b/Sources/Commands/Utilities/PluginDelegate.swift index 34192308c3a..448dbe5d1b8 100644 --- a/Sources/Commands/Utilities/PluginDelegate.swift +++ b/Sources/Commands/Utilities/PluginDelegate.swift @@ -423,8 +423,8 @@ final class PluginDelegate: PluginInvocationDelegate { func lookupDescription( for moduleName: String, destination: BuildParameters.Destination - ) throws -> ModuleBuildDescription? { - try buildPlan.buildModules.first { + ) -> ModuleBuildDescription? { + buildPlan.buildModules.first { $0.module.name == moduleName && $0.buildParameters.destination == destination } } @@ -434,9 +434,9 @@ final class PluginDelegate: PluginInvocationDelegate { // historically how this was setup. Ideally we should be building for both "host" // and "target" if module is configured for them but that would require changing // `PluginInvocationSymbolGraphResult` to carry multiple directories. - let description = if let targetDescription = try lookupDescription(for: targetName, destination: .target) { + let description = if let targetDescription = lookupDescription(for: targetName, destination: .target) { targetDescription - } else if let hostDescription = try lookupDescription(for: targetName, destination: .host) { + } else if let hostDescription = lookupDescription(for: targetName, destination: .host) { hostDescription } else { throw InternalError("could not find a target named: \(targetName)") diff --git a/Sources/Workspace/Workspace+Delegation.swift b/Sources/Workspace/Workspace+Delegation.swift index f17e38e923d..4203ff1f829 100644 --- a/Sources/Workspace/Workspace+Delegation.swift +++ b/Sources/Workspace/Workspace+Delegation.swift @@ -216,7 +216,7 @@ extension WorkspaceDelegate { } } -struct WorkspaceManifestLoaderDelegate: ManifestLoader.Delegate { +struct WorkspaceManifestLoaderDelegate: ManifestLoader.Delegate, @unchecked Sendable { private weak var workspaceDelegate: Workspace.Delegate? init(workspaceDelegate: Workspace.Delegate) { @@ -279,7 +279,7 @@ struct WorkspaceManifestLoaderDelegate: ManifestLoader.Delegate { } } -struct WorkspaceRepositoryManagerDelegate: RepositoryManager.Delegate { +struct WorkspaceRepositoryManagerDelegate: RepositoryManager.Delegate, @unchecked Sendable { private weak var workspaceDelegate: Workspace.Delegate? init(workspaceDelegate: Workspace.Delegate) { @@ -335,7 +335,7 @@ struct WorkspaceRepositoryManagerDelegate: RepositoryManager.Delegate { } } -struct WorkspaceRegistryDownloadsManagerDelegate: RegistryDownloadsManager.Delegate { +struct WorkspaceRegistryDownloadsManagerDelegate: RegistryDownloadsManager.Delegate, @unchecked Sendable { private weak var workspaceDelegate: Workspace.Delegate? init(workspaceDelegate: Workspace.Delegate) { diff --git a/Sources/_InternalTestSupport/GitRepositoryExtensions.swift b/Sources/_InternalTestSupport/GitRepositoryExtensions.swift index 403599df450..46a83a67aa1 100644 --- a/Sources/_InternalTestSupport/GitRepositoryExtensions.swift +++ b/Sources/_InternalTestSupport/GitRepositoryExtensions.swift @@ -13,6 +13,7 @@ import SourceControl import class Basics.AsyncProcess +import class TSCBasic.Process import enum TSCUtility.Git @@ -21,7 +22,7 @@ import enum TSCUtility.Git package extension GitRepository { /// Create the repository using git init. func create() throws { - try systemQuietly([Git.tool, "-C", self.path.pathString, "init"]) + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "init") } /// Returns current branch name. If HEAD is on a detached state, this returns HEAD. @@ -38,36 +39,36 @@ package extension GitRepository { /// Stage a file. func stage(file: String) throws { - try systemQuietly([Git.tool, "-C", self.path.pathString, "add", file]) + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "add", file) } /// Stage multiple files. func stage(files: String...) throws { - try systemQuietly([Git.tool, "-C", self.path.pathString, "add"] + files) + try Process.checkNonZeroExit(arguments: [Git.tool, "-C", self.path.pathString, "add"] + files) } /// Stage entire unstaged changes. func stageEverything() throws { - try systemQuietly([Git.tool, "-C", self.path.pathString, "add", "."]) + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "add", ".") } /// Commit the staged changes. If the message is not provided a dummy message will be used for the commit. func commit(message: String? = nil) throws { // FIXME: We don't need to set these every time but we usually only commit once or twice for a test repo. - try systemQuietly([Git.tool, "-C", self.path.pathString, "config", "user.email", "example@example.com"]) - try systemQuietly([Git.tool, "-C", self.path.pathString, "config", "user.name", "Example Example"]) - try systemQuietly([Git.tool, "-C", self.path.pathString, "config", "commit.gpgsign", "false"]) - try systemQuietly([Git.tool, "-C", self.path.pathString, "config", "tag.gpgsign", "false"]) - try systemQuietly([Git.tool, "-C", self.path.pathString, "commit", "-m", message ?? "Add some files."]) + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "config", "user.email", "example@example.com") + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "config", "user.name", "Example Example") + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "config", "commit.gpgsign", "false") + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "config", "tag.gpgsign", "false") + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "commit", "-m", message ?? "Add some files.") } /// Tag the git repo. func tag(name: String) throws { - try systemQuietly([Git.tool, "-C", self.path.pathString, "tag", name]) + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "tag", name) } /// Push the changes to specified remote and branch. func push(remote: String, branch: String) throws { - try systemQuietly([Git.tool, "-C", self.path.pathString, "push", remote, branch]) + try Process.checkNonZeroExit(args: Git.tool, "-C", self.path.pathString, "push", remote, branch) } } diff --git a/Sources/_InternalTestSupport/InMemoryGitRepository.swift b/Sources/_InternalTestSupport/InMemoryGitRepository.swift index 035876c2f40..cb8f5870534 100644 --- a/Sources/_InternalTestSupport/InMemoryGitRepository.swift +++ b/Sources/_InternalTestSupport/InMemoryGitRepository.swift @@ -396,7 +396,7 @@ extension InMemoryGitRepository: WorkingCheckout { extension InMemoryGitRepository: @unchecked Sendable {} /// This class implement provider for in memory git repository. -public final class InMemoryGitRepositoryProvider: RepositoryProvider { +public final class InMemoryGitRepositoryProvider: RepositoryProvider, @unchecked Sendable { /// Contains the repository added to this provider. public var specifierMap = ThreadSafeKeyValueStore() diff --git a/Sources/_InternalTestSupport/misc.swift b/Sources/_InternalTestSupport/misc.swift index 4a069fdd5c1..ca45f919477 100644 --- a/Sources/_InternalTestSupport/misc.swift +++ b/Sources/_InternalTestSupport/misc.swift @@ -32,12 +32,12 @@ import Testing import func XCTest.XCTFail import struct XCTest.XCTSkip +import class TSCBasic.Process import struct TSCBasic.ByteString import struct Basics.AsyncProcessResult import enum TSCUtility.Git -@_exported import func TSCTestSupport.systemQuietly @_exported import enum TSCTestSupport.StringPattern @available(*, deprecated, message: "Use CiEnvironment.runningInSmokeTestPipeline") @@ -305,7 +305,7 @@ fileprivate func setup( #if os(Windows) try localFileSystem.copy(from: srcDir, to: dstDir) #else - try systemQuietly("cp", "-R", "-H", srcDir.pathString, dstDir.pathString) + try Process.checkNonZeroExit(args: "cp", "-R", "-H", srcDir.pathString, dstDir.pathString) #endif // Ensure we get a clean test fixture. @@ -361,17 +361,17 @@ public func initGitRepo( try localFileSystem.writeFileContents(file, bytes: "") } - try systemQuietly([Git.tool, "-C", dir.pathString, "init"]) - try systemQuietly([Git.tool, "-C", dir.pathString, "config", "user.email", "example@example.com"]) - try systemQuietly([Git.tool, "-C", dir.pathString, "config", "user.name", "Example Example"]) - try systemQuietly([Git.tool, "-C", dir.pathString, "config", "commit.gpgsign", "false"]) + try Process.checkNonZeroExit(args: Git.tool, "-C", dir.pathString, "init") + try Process.checkNonZeroExit(args: Git.tool, "-C", dir.pathString, "config", "user.email", "example@example.com") + try Process.checkNonZeroExit(args: Git.tool, "-C", dir.pathString, "config", "user.name", "Example Example") + try Process.checkNonZeroExit(args: Git.tool, "-C", dir.pathString, "config", "commit.gpgsign", "false") let repo = GitRepository(path: dir) try repo.stageEverything() try repo.commit(message: "msg") for tag in tags { try repo.tag(name: tag) } - try systemQuietly([Git.tool, "-C", dir.pathString, "branch", "-m", "main"]) + try Process.checkNonZeroExit(args: Git.tool, "-C", dir.pathString, "branch", "-m", "main") } catch { XCTFail("\(error.interpolationDescription)", file: file, line: line) } diff --git a/Tests/FunctionalTests/MiscellaneousTests.swift b/Tests/FunctionalTests/MiscellaneousTests.swift index 1a7e39d6554..7f40f146f98 100644 --- a/Tests/FunctionalTests/MiscellaneousTests.swift +++ b/Tests/FunctionalTests/MiscellaneousTests.swift @@ -277,8 +277,8 @@ final class MiscellaneousTestCase: XCTestCase { // Create a shared library. let input = systemModule.appending(components: "Sources", "SystemModule.c") let triple = try UserToolchain.default.targetTriple - let output = systemModule.appending("libSystemModule\(triple.dynamicLibraryExtension)") - try systemQuietly([executableName("clang"), "-shared", input.pathString, "-o", output.pathString]) + let output = systemModule.appending("libSystemModule\(triple.dynamicLibraryExtension)") + try await AsyncProcess.checkNonZeroExit(args: executableName("clang"), "-shared", input.pathString, "-o", output.pathString) let pcFile = fixturePath.appending("libSystemModule.pc") @@ -686,7 +686,7 @@ final class MiscellaneousTestCase: XCTestCase { guard case SwiftPMError.executionFailure(_, _, let stderr) = error else { return XCTFail("invalid error \(error)") } - XCTAssert(stderr.contains("error: You don’t have permission"), "expected permissions error. stderr: '\(stderr)'") + XCTAssert(stderr.contains("invalid access"), "expected permissions error. stderr: '\(stderr)'") } XCTAssertNoSuchPath(customCachePath) } @@ -721,7 +721,7 @@ final class MiscellaneousTestCase: XCTestCase { guard case SwiftPMError.executionFailure(_, _, let stderr) = error else { return XCTFail("invalid error \(error)") } - XCTAssert(stderr.contains("error: You don’t have permission"), "expected permissions error. stderr: '\(stderr)'") + XCTAssert(stderr.contains("invalid access"), "expected permissions error. stderr: '\(stderr)'") } XCTAssertNoSuchPath(customConfigPath) } @@ -756,7 +756,7 @@ final class MiscellaneousTestCase: XCTestCase { guard case SwiftPMError.executionFailure(_, _, let stderr) = error else { return XCTFail("invalid error \(error)") } - XCTAssert(stderr.contains("error: You don’t have permission"), "expected permissions error. stderr: '\(stderr)'") + XCTAssert(stderr.contains("invalid access"), "expected permissions error. stderr: '\(stderr)'") } } #endif diff --git a/Tests/FunctionalTests/ModuleMapTests.swift b/Tests/FunctionalTests/ModuleMapTests.swift index aed18490fe2..94d72a6ac3a 100644 --- a/Tests/FunctionalTests/ModuleMapTests.swift +++ b/Tests/FunctionalTests/ModuleMapTests.swift @@ -30,7 +30,7 @@ final class ModuleMapsTestCase: XCTestCase { let outdir = fixturePath.appending(components: rootpkg, ".build", triple.platformBuildPathComponent, "debug") try makeDirectories(outdir) let output = outdir.appending("libfoo\(triple.dynamicLibraryExtension)") - try systemQuietly([executableName("clang"), "-shared", input.pathString, "-o", output.pathString]) + try await AsyncProcess.checkNonZeroExit(args: executableName("clang"), "-shared", input.pathString, "-o", output.pathString) var Xld = ["-L", outdir.pathString] #if os(Linux) || os(Android) diff --git a/Tests/FunctionalTests/StaticBinaryLibrary.swift b/Tests/FunctionalTests/StaticBinaryLibrary.swift index 7d4e26e2fba..a3298ddf992 100644 --- a/Tests/FunctionalTests/StaticBinaryLibrary.swift +++ b/Tests/FunctionalTests/StaticBinaryLibrary.swift @@ -24,7 +24,7 @@ struct StaticBinaryLibraryTests { try await withKnownIssue { try await fixture(name: "BinaryLibraries") { fixturePath in - let (stdout, stderr) = try await executeSwiftRun( + let (stdout, _) = try await executeSwiftRun( fixturePath.appending("Static").appending("Package1"), "Example", extraArgs: ["--experimental-prune-unused-dependencies"], diff --git a/Tests/IntegrationTests/SwiftPMTests.swift b/Tests/IntegrationTests/SwiftPMTests.swift index 5a016f47de0..34ad0f9e3d7 100644 --- a/Tests/IntegrationTests/SwiftPMTests.swift +++ b/Tests/IntegrationTests/SwiftPMTests.swift @@ -20,7 +20,7 @@ import struct SPMBuildCore.BuildSystemProvider private struct SwiftPMTests { @Test(.requireHostOS(.macOS)) func binaryTargets() async throws { - try await withKnownIssue("error: the path does not point to a valid framework:") { + await withKnownIssue("error: the path does not point to a valid framework:") { try await binaryTargetsFixture { fixturePath in do { await withKnownIssue("error: local binary target ... does not contain a binary artifact") { diff --git a/Tests/PackageGraphTests/ModulesGraphTests.swift b/Tests/PackageGraphTests/ModulesGraphTests.swift index 878d3a47902..38f04feca5e 100644 --- a/Tests/PackageGraphTests/ModulesGraphTests.swift +++ b/Tests/PackageGraphTests/ModulesGraphTests.swift @@ -2283,7 +2283,7 @@ struct ModulesGraphTests { let observability = try loadUnsafeModulesGraph(toolsVersion: .v6_1) #expect(observability.diagnostics.count == 3) - try testDiagnostics(observability.diagnostics) { result in + testDiagnostics(observability.diagnostics) { result in var expectedMetadata = ObservabilityMetadata() expectedMetadata.moduleName = "Foo2" let diagnostic1 = try #require(result.checkUnordered( diff --git a/Tests/PackageSigningTests/SigningTests.swift b/Tests/PackageSigningTests/SigningTests.swift index 4fd1fd6db61..ed2e425b5e4 100644 --- a/Tests/PackageSigningTests/SigningTests.swift +++ b/Tests/PackageSigningTests/SigningTests.swift @@ -786,10 +786,8 @@ struct SigningTests { return } switch signingEntity { - case .recognized(_, let name, let organizationalUnit, let organization): - #expect(name != nil) - #expect(organizationalUnit != nil) - #expect(organization != nil) + case .recognized: + break case .unrecognized(let name, let organizationalUnit, let organization): #expect(name != nil) #expect(organizationalUnit != nil) @@ -841,10 +839,8 @@ struct SigningTests { return } switch signingEntity { - case .recognized(_, let name, let organizationalUnit, let organization): - #expect(name != nil) - #expect(organizationalUnit != nil) - #expect(organization != nil) + case .recognized: + break case .unrecognized(let name, let organizationalUnit, let organization): #expect(name != nil) #expect(organizationalUnit != nil) @@ -896,10 +892,8 @@ struct SigningTests { return } switch signingEntity { - case .recognized(_, let name, let organizationalUnit, let organization): - #expect(name != nil) - #expect(organizationalUnit != nil) - #expect(organization != nil) + case .recognized: + break case .unrecognized(let name, let organizationalUnit, let organization): #expect(name != nil) #expect(organizationalUnit != nil) diff --git a/Tests/SourceControlTests/GitRepositoryTests.swift b/Tests/SourceControlTests/GitRepositoryTests.swift index 01f5b297e8c..b9ee3871aaf 100644 --- a/Tests/SourceControlTests/GitRepositoryTests.swift +++ b/Tests/SourceControlTests/GitRepositoryTests.swift @@ -129,17 +129,17 @@ class GitRepositoryTests: XCTestCase { /// In order to be stable, this test uses a static test git repository in /// `Inputs`, which has known commit hashes. See the `construct.sh` script /// contained within it for more information. - func testRawRepository() throws { + func testRawRepository() async throws { try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8385: test repository has non-portable file names") try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8564", skipSelfHostedCI: true) - try testWithTemporaryDirectory { path in + try await testWithTemporaryDirectory { path in // Unarchive the static test repository. let inputArchivePath = AbsolutePath(#file).parentDirectory.appending(components: "Inputs", "TestRepo.tgz") #if os(Windows) - try systemQuietly(["tar.exe", "-x", "-v", "-C", path.pathString, "-f", inputArchivePath.pathString]) + try await AsyncProcess.checkNonZeroExit(args: "tar.exe", "-x", "-v", "-C", path.pathString, "-f", inputArchivePath.pathString) #else - try systemQuietly(["tar", "--no-same-owner", "-x", "-v", "-C", path.pathString, "-f", inputArchivePath.pathString]) + try await AsyncProcess.checkNonZeroExit(args: "tar", "--no-same-owner", "-x", "-v", "-C", path.pathString, "-f", inputArchivePath.pathString) #endif let testRepoPath = path.appending("TestRepo") @@ -400,7 +400,7 @@ class GitRepositoryTests: XCTestCase { // Create a bare clone it somewhere because we want to later push into the repo. let testBareRepoPath = path.appending("test-repo-bare") - try systemQuietly([Git.tool, "clone", "--bare", testRepoPath.pathString, testBareRepoPath.pathString]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "clone", "--bare", testRepoPath.pathString, testBareRepoPath.pathString) // Clone it somewhere. let testClonePath = path.appending("clone") @@ -427,9 +427,9 @@ class GitRepositoryTests: XCTestCase { } } - func testSetRemote() throws { + func testSetRemote() async throws { try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8564", skipSelfHostedCI: true) - try testWithTemporaryDirectory { path in + try await testWithTemporaryDirectory { path in // Create a repo. let testRepoPath = path.appending("test-repo") try makeDirectories(testRepoPath) @@ -440,7 +440,7 @@ class GitRepositoryTests: XCTestCase { XCTAssert(try repo.remotes().isEmpty) // Add a remote via git cli. - try systemQuietly([Git.tool, "-C", testRepoPath.pathString, "remote", "add", "origin", "../foo"]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", testRepoPath.pathString, "remote", "add", "origin", "../foo") // Test if it was added. XCTAssertEqual(Dictionary(uniqueKeysWithValues: try repo.remotes().map { ($0.0, $0.1) }), ["origin": "../foo"]) // Change remote. @@ -486,9 +486,9 @@ class GitRepositoryTests: XCTestCase { } } - func testBranchOperations() throws { + func testBranchOperations() async throws { try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8564", skipSelfHostedCI: true) - try testWithTemporaryDirectory { path in + try await testWithTemporaryDirectory { path in // Create a repo. let testRepoPath = path.appending("test-repo") try makeDirectories(testRepoPath) @@ -501,7 +501,7 @@ class GitRepositoryTests: XCTestCase { // Check a non existent revision. XCTAssertFalse(repo.exists(revision: Revision(identifier: "nonExistent"))) // Checkout a new branch using command line. - try systemQuietly([Git.tool, "-C", testRepoPath.pathString, "checkout", "-b", "TestBranch1"]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", testRepoPath.pathString, "checkout", "-b", "TestBranch1") XCTAssertTrue(repo.exists(revision: Revision(identifier: "TestBranch1"))) XCTAssertEqual(try repo.getCurrentRevision(), currentRevision) @@ -658,7 +658,7 @@ class GitRepositoryTests: XCTestCase { try bar.commit() // Update the ref of bar in foo and tag as 1.0.2 - try systemQuietly([Git.tool, "-C", fooPath.appending("bar").pathString, "pull"]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", fooPath.appending("bar").pathString, "pull") try foo.stageEverything() try foo.commit() try foo.tag(name: "1.0.2") @@ -761,10 +761,10 @@ class GitRepositoryTests: XCTestCase { // Create a `newMain` branch and remove `main`. try repo.checkout(newBranch: "newMain") - try systemQuietly([Git.tool, "-C", testRepoPath.pathString, "branch", "-D", "main"]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", testRepoPath.pathString, "branch", "-D", "main") // Change the branch name to something non-existent. - try systemQuietly([Git.tool, "-C", testRepoPath.pathString, "symbolic-ref", "HEAD", "refs/heads/_non_existent_branch_"]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", testRepoPath.pathString, "symbolic-ref", "HEAD", "refs/heads/_non_existent_branch_") // Clone it somewhere. let testClonePath = path.appending("clone") @@ -790,7 +790,7 @@ class GitRepositoryTests: XCTestCase { func testValidDirectoryLocalRelativeOrigin() async throws { try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8564", skipSelfHostedCI: true) - try testWithTemporaryDirectory { tmpDir in + try await testWithTemporaryDirectory { tmpDir in // Create a repository. let packageDir = tmpDir.appending("SomePackage") try localFileSystem.createDirectory(packageDir) @@ -813,7 +813,7 @@ class GitRepositoryTests: XCTestCase { initGitRepo(packageDir) // Set the remote. - try systemQuietly([Git.tool, "-C", packageDir.pathString, "remote", "add", "origin", customRemote]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", packageDir.pathString, "remote", "add", "origin", customRemote) XCTAssertTrue(try repositoryManager.isValidDirectory(packageDir)) let customRemoteWithoutPathExtension = (customRemote as NSString).deletingPathExtension @@ -837,7 +837,7 @@ class GitRepositoryTests: XCTestCase { func testValidDirectoryLocalAbsoluteOrigin() async throws { try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8564", skipSelfHostedCI: true) - try testWithTemporaryDirectory { tmpDir in + try await testWithTemporaryDirectory { tmpDir in // Create a repository. let packageDir = tmpDir.appending("SomePackage") try localFileSystem.createDirectory(packageDir) @@ -860,7 +860,7 @@ class GitRepositoryTests: XCTestCase { initGitRepo(packageDir) // Set the remote. - try systemQuietly([Git.tool, "-C", packageDir.pathString, "remote", "add", "origin", customRemote.pathString]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", packageDir.pathString, "remote", "add", "origin", customRemote.pathString) XCTAssertTrue(try repositoryManager.isValidDirectory(packageDir)) let customRemotePath = customRemote.pathString @@ -888,7 +888,7 @@ class GitRepositoryTests: XCTestCase { func testValidDirectoryRemoteOrigin() async throws { try XCTSkipOnWindows(because: "https://github.com/swiftlang/swift-package-manager/issues/8564", skipSelfHostedCI: true) - try testWithTemporaryDirectory { tmpDir in + try await testWithTemporaryDirectory { tmpDir in // Create a repository. let packageDir = tmpDir.appending("SomePackage") try localFileSystem.createDirectory(packageDir) @@ -910,7 +910,7 @@ class GitRepositoryTests: XCTestCase { initGitRepo(packageDir) // Set the remote. - try systemQuietly([Git.tool, "-C", packageDir.pathString, "remote", "add", "origin", customRemote.absoluteString]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", packageDir.pathString, "remote", "add", "origin", customRemote.absoluteString) XCTAssertTrue(try repositoryManager.isValidDirectory(packageDir)) XCTAssertTrue(try repositoryManager.isValidDirectory(packageDir, for: RepositorySpecifier(url: SourceControlURL(customRemote)))) diff --git a/Tests/WorkspaceTests/SourceControlPackageContainerTests.swift b/Tests/WorkspaceTests/SourceControlPackageContainerTests.swift index fce433b382f..e73fb132090 100644 --- a/Tests/WorkspaceTests/SourceControlPackageContainerTests.swift +++ b/Tests/WorkspaceTests/SourceControlPackageContainerTests.swift @@ -532,7 +532,7 @@ final class SourceControlPackageContainerTests: XCTestCase { try packageRepo.tag(name: "1.0.0") // Rename the `master` branch to `main`. - try systemQuietly([Git.tool, "-C", packageDir.pathString, "branch", "-m", "main"]) + try await AsyncProcess.checkNonZeroExit(args: Git.tool, "-C", packageDir.pathString, "branch", "-m", "main") // Create a repository manager for it. let repoProvider = GitRepositoryProvider() diff --git a/Tests/WorkspaceTests/ToolsVersionSpecificationRewriterTests.swift b/Tests/WorkspaceTests/ToolsVersionSpecificationRewriterTests.swift index 9a67dd5ad5a..729ebcad731 100644 --- a/Tests/WorkspaceTests/ToolsVersionSpecificationRewriterTests.swift +++ b/Tests/WorkspaceTests/ToolsVersionSpecificationRewriterTests.swift @@ -120,7 +120,7 @@ fileprivate struct ToolsVersionSpecificationRewriterTests { ) // resultHandler(try inMemoryFileSystem.readFileContents(manifestFilePath)) - let actual = try #require(try inMemoryFileSystem.readFileContents(manifestFilePath)) + let actual = try inMemoryFileSystem.readFileContents(manifestFilePath) #expect(actual.validDescription == expected, "Actual is not expected") }