diff --git a/Sources/_InternalTestSupport/misc.swift b/Sources/_InternalTestSupport/misc.swift index 6e5d170125f..f64f1cdb113 100644 --- a/Sources/_InternalTestSupport/misc.swift +++ b/Sources/_InternalTestSupport/misc.swift @@ -28,6 +28,7 @@ import SPMBuildCore import struct SPMBuildCore.BuildParameters import TSCTestSupport import Workspace +import Testing import func XCTest.XCTFail import struct XCTest.XCTSkip @@ -112,7 +113,8 @@ public func testWithTemporaryDirectory( /// The temporary copy is deleted after the block returns. The fixture name may /// contain `/` characters, which are treated as path separators, exactly as if /// the name were a relative path. -@discardableResult public func fixture( +@available(*, deprecated, message: "Migrate test to Swift Testing and use 'fixture' instead") +@discardableResult public func fixtureXCTest( name: String, createGitRepo: Bool = true, file: StaticString = #file, @@ -133,7 +135,44 @@ public func testWithTemporaryDirectory( try? localFileSystem.removeFileTree(tmpDirPath) } - let fixtureDir = try verifyFixtureExists(at: fixtureSubpath, file: file, line: line) + let fixtureDir = try verifyFixtureExistsXCTest(at: fixtureSubpath, file: file, line: line) + let preparedFixture = try setup( + fixtureDir: fixtureDir, + in: tmpDirPath, + copyName: copyName, + createGitRepo:createGitRepo + ) + return try body(preparedFixture) + } + } catch SwiftPMError.executionFailure(let error, let output, let stderr) { + print("**** FAILURE EXECUTING SUBPROCESS ****") + print("output:", output) + print("stderr:", stderr) + throw error + } +} + +@discardableResult public func fixture( + name: String, + createGitRepo: Bool = true, + sourceLocation: SourceLocation = #_sourceLocation, + body: (AbsolutePath) throws -> T +) throws -> T { + do { + // Make a suitable test directory name from the fixture subpath. + let fixtureSubpath = try RelativePath(validating: name) + let copyName = fixtureSubpath.components.joined(separator: "_") + + // Create a temporary directory for the duration of the block. + return try withTemporaryDirectory(prefix: copyName) { tmpDirPath in + + defer { + // Unblock and remove the tmp dir on deinit. + try? localFileSystem.chmod(.userWritable, path: tmpDirPath, options: [.recursive]) + try? localFileSystem.removeFileTree(tmpDirPath) + } + + let fixtureDir = try verifyFixtureExists(at: fixtureSubpath, sourceLocation: sourceLocation) let preparedFixture = try setup( fixtureDir: fixtureDir, in: tmpDirPath, @@ -154,7 +193,8 @@ public enum TestError: Error { case platformNotSupported } -@discardableResult public func fixture( +@available(*, deprecated, message: "Migrate test to Swift Testing and use 'fixture' instead") +@discardableResult public func fixtureXCTest( name: String, createGitRepo: Bool = true, file: StaticString = #file, @@ -175,7 +215,7 @@ public enum TestError: Error { try? localFileSystem.removeFileTree(tmpDirPath) } - let fixtureDir = try verifyFixtureExists(at: fixtureSubpath, file: file, line: line) + let fixtureDir = try verifyFixtureExistsXCTest(at: fixtureSubpath, file: file, line: line) let preparedFixture = try setup( fixtureDir: fixtureDir, in: tmpDirPath, @@ -192,7 +232,44 @@ public enum TestError: Error { } } -fileprivate func verifyFixtureExists(at fixtureSubpath: RelativePath, file: StaticString = #file, line: UInt = #line) throws -> AbsolutePath { +@discardableResult public func fixture( + name: String, + createGitRepo: Bool = true, + sourceLocation: SourceLocation = #_sourceLocation, + body: (AbsolutePath) async throws -> T +) async throws -> T { + do { + // Make a suitable test directory name from the fixture subpath. + let fixtureSubpath = try RelativePath(validating: name) + let copyName = fixtureSubpath.components.joined(separator: "_") + + // Create a temporary directory for the duration of the block. + return try await withTemporaryDirectory(prefix: copyName) { tmpDirPath in + + defer { + // Unblock and remove the tmp dir on deinit. + try? localFileSystem.chmod(.userWritable, path: tmpDirPath, options: [.recursive]) + try? localFileSystem.removeFileTree(tmpDirPath) + } + + let fixtureDir = try verifyFixtureExists(at: fixtureSubpath, sourceLocation: sourceLocation) + let preparedFixture = try setup( + fixtureDir: fixtureDir, + in: tmpDirPath, + copyName: copyName, + createGitRepo:createGitRepo + ) + return try await body(preparedFixture) + } + } catch SwiftPMError.executionFailure(let error, let output, let stderr) { + print("**** FAILURE EXECUTING SUBPROCESS ****") + print("output:", output) + print("stderr:", stderr) + throw error + } +} + +fileprivate func verifyFixtureExistsXCTest(at fixtureSubpath: RelativePath, file: StaticString = #file, line: UInt = #line) throws -> AbsolutePath { let fixtureDir = AbsolutePath("../../../Fixtures", relativeTo: #file) .appending(fixtureSubpath) @@ -205,6 +282,19 @@ fileprivate func verifyFixtureExists(at fixtureSubpath: RelativePath, file: Stat return fixtureDir } +fileprivate func verifyFixtureExists(at fixtureSubpath: RelativePath, sourceLocation: SourceLocation = #_sourceLocation) throws -> AbsolutePath { + let fixtureDir = AbsolutePath("../../../Fixtures", relativeTo: #file) + .appending(fixtureSubpath) + + // Check that the fixture is really there. + guard localFileSystem.isDirectory(fixtureDir) else { + Issue.record("No such fixture: \(fixtureDir)", sourceLocation: sourceLocation) + throw SwiftPMError.packagePathNotFound + } + + return fixtureDir +} + fileprivate func setup( fixtureDir: AbsolutePath, in tmpDirPath: AbsolutePath, diff --git a/Tests/BuildTests/BuildPlanTests.swift b/Tests/BuildTests/BuildPlanTests.swift index 0023a4362a5..dacf31e9e0f 100644 --- a/Tests/BuildTests/BuildPlanTests.swift +++ b/Tests/BuildTests/BuildPlanTests.swift @@ -628,7 +628,7 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { toolchain: UserToolchain.default, fileSystem: localFileSystem ) - try await fixture(name: "Miscellaneous/PackageNameFlag") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/PackageNameFlag") { fixturePath in let (stdout, stderr) = try await executeSwiftBuild( fixturePath.appending("appPkg"), extraArgs: ["--vv"], @@ -666,7 +666,7 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { toolchain: UserToolchain.default, fileSystem: localFileSystem ) - try await fixture(name: "Miscellaneous/PackageNameFlag") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/PackageNameFlag") { fixturePath in let (stdout, _) = try await executeSwiftBuild( fixturePath.appending("appPkg"), extraArgs: ["--vv"], @@ -697,7 +697,7 @@ class BuildPlanTestCase: BuildSystemProviderTestCase { toolchain: UserToolchain.default, fileSystem: localFileSystem ) - try await fixture(name: "Miscellaneous/TargetPackageAccess") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/TargetPackageAccess") { fixturePath in let (stdout, _) = try await executeSwiftBuild( fixturePath.appending("libPkg"), extraArgs: ["-v"], diff --git a/Tests/BuildTests/BuildSystemDelegateTests.swift b/Tests/BuildTests/BuildSystemDelegateTests.swift index 10a5d495add..4386199c723 100644 --- a/Tests/BuildTests/BuildSystemDelegateTests.swift +++ b/Tests/BuildTests/BuildSystemDelegateTests.swift @@ -19,7 +19,7 @@ import var TSCBasic.localFileSystem final class BuildSystemDelegateTests: XCTestCase { func testDoNotFilterLinkerDiagnostics() async throws { try XCTSkipIf(!UserToolchain.default.supportsSDKDependentTests(), "skipping because test environment doesn't support this test") - try await fixture(name: "Miscellaneous/DoNotFilterLinkerDiagnostics") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/DoNotFilterLinkerDiagnostics") { fixturePath in #if !os(macOS) // These linker diagnostics are only produced on macOS. try XCTSkipIf(true, "test is only supported on macOS") @@ -39,7 +39,7 @@ final class BuildSystemDelegateTests: XCTestCase { #else let executableExt = "" #endif - try await fixture(name: "Miscellaneous/TestableExe") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/TestableExe") { fixturePath in _ = try await executeSwiftBuild(fixturePath) let execPath = fixturePath.appending(components: ".build", "debug", "TestableExe1\(executableExt)") XCTAssertTrue(localFileSystem.exists(execPath), "executable not found at '\(execPath)'") diff --git a/Tests/BuildTests/IncrementalBuildTests.swift b/Tests/BuildTests/IncrementalBuildTests.swift index 31f80abad08..8fc45197abe 100644 --- a/Tests/BuildTests/IncrementalBuildTests.swift +++ b/Tests/BuildTests/IncrementalBuildTests.swift @@ -40,7 +40,7 @@ final class IncrementalBuildTests: XCTestCase { func testIncrementalSingleModuleCLibraryInSources() async throws { try XCTSkipIf(!UserToolchain.default.supportsSDKDependentTests(), "skipping because test environment doesn't support this test") - try await fixture(name: "CFamilyTargets/CLibrarySources") { fixturePath in + try await fixtureXCTest(name: "CFamilyTargets/CLibrarySources") { fixturePath in // Build it once and capture the log (this will be a full build). let (fullLog, _) = try await executeSwiftBuild(fixturePath) @@ -98,7 +98,7 @@ final class IncrementalBuildTests: XCTestCase { func testBuildManifestCaching() async throws { try XCTSkipIf(!UserToolchain.default.supportsSDKDependentTests(), "skipping because test environment doesn't support this test") - try await fixture(name: "ValidLayouts/SingleModule/Library") { fixturePath in + try await fixtureXCTest(name: "ValidLayouts/SingleModule/Library") { fixturePath in @discardableResult func build() async throws -> String { return try await executeSwiftBuild(fixturePath).stdout @@ -132,7 +132,7 @@ final class IncrementalBuildTests: XCTestCase { func testDisableBuildManifestCaching() async throws { try XCTSkipIf(!UserToolchain.default.supportsSDKDependentTests(), "skipping because test environment doesn't support this test") - try await fixture(name: "ValidLayouts/SingleModule/Library") { fixturePath in + try await fixtureXCTest(name: "ValidLayouts/SingleModule/Library") { fixturePath in @discardableResult func build() async throws -> String { return try await executeSwiftBuild(fixturePath, extraArgs: ["--disable-build-manifest-caching"]).stdout @@ -152,7 +152,7 @@ final class IncrementalBuildTests: XCTestCase { #if os(macOS) try XCTSkipIf(!UserToolchain.default.supportsSDKDependentTests(), "skipping because test environment doesn't support this test") - try await fixture(name: "ValidLayouts/SingleModule/Library") { fixturePath in + try await fixtureXCTest(name: "ValidLayouts/SingleModule/Library") { fixturePath in let dummySwiftcPath = SwiftPM.xctestBinaryPath(for: "dummy-swiftc") let swiftCompilerPath = try UserToolchain.default.swiftCompilerPath let environment: Environment = [ diff --git a/Tests/BuildTests/PluginsBuildPlanTests.swift b/Tests/BuildTests/PluginsBuildPlanTests.swift index 64e8fc609ec..7737b869969 100644 --- a/Tests/BuildTests/PluginsBuildPlanTests.swift +++ b/Tests/BuildTests/PluginsBuildPlanTests.swift @@ -20,7 +20,7 @@ final class PluginsBuildPlanTests: XCTestCase { func testBuildToolsDatabasePath() async throws { try XCTSkipOnWindows(because: "Fails to build the project to due to incorrect Path handling. Possibly related to https://github.com/swiftlang/swift-package-manager/issues/8511") - try await fixture(name: "Miscellaneous/Plugins/MySourceGenPlugin") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/MySourceGenPlugin") { fixturePath in let (stdout, _) = try await executeSwiftBuild(fixturePath) XCTAssertMatch(stdout, .contains("Build complete!")) // FIXME: This is temporary until build of plugin tools is extracted into its own command. @@ -48,7 +48,7 @@ final class PluginsBuildPlanTests: XCTestCase { let targetTriple = hostToolchain.targetTriple.arch == .aarch64 ? x86Triple : armTriple // By default, plugin dependencies are built for the host platform - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let (stdout, stderr) = try await executeSwiftPackage(fixturePath, extraArgs: ["-v", "build-plugin-dependency"]) XCTAssertMatch(stdout, .contains("Hello from dependencies-stub")) XCTAssertMatch(stderr, .contains("Build of product 'plugintool' complete!")) @@ -65,7 +65,7 @@ final class PluginsBuildPlanTests: XCTestCase { } // When cross compiling the final product, plugin dependencies should still be built for the host - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let (stdout, stderr) = try await executeSwiftPackage(fixturePath, extraArgs: ["--triple", targetTriple, "-v", "build-plugin-dependency"]) XCTAssertMatch(stdout, .contains("Hello from dependencies-stub")) XCTAssertMatch(stderr, .contains("Build of product 'plugintool' complete!")) diff --git a/Tests/CommandsTests/PackageCommandTests.swift b/Tests/CommandsTests/PackageCommandTests.swift index 6c57e6d4aa8..9b467de7372 100644 --- a/Tests/CommandsTests/PackageCommandTests.swift +++ b/Tests/CommandsTests/PackageCommandTests.swift @@ -127,7 +127,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testUnknownSubcommand() async throws { - try await fixture(name: "Miscellaneous/ExeTest") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/ExeTest") { fixturePath in await XCTAssertThrowsCommandExecutionError(try await execute(["foo"], packagePath: fixturePath)) { error in XCTAssertMatch(error.stderr, .contains("Unknown subcommand or plugin name ‘foo’")) } @@ -135,7 +135,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testNetrc() async throws { - try await fixture(name: "DependencyResolution/External/XCFramework") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/XCFramework") { fixturePath in // --enable-netrc flag try await self.execute(["resolve", "--enable-netrc"], packagePath: fixturePath) @@ -152,7 +152,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testNetrcFile() async throws { - try await fixture(name: "DependencyResolution/External/XCFramework") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/XCFramework") { fixturePath in let fs = localFileSystem let netrcPath = fixturePath.appending(".netrc") try fs.writeFileContents( @@ -187,7 +187,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testEnableDisableCache() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let repositoriesPath = packageRoot.appending(components: ".build", "repositories") let cachePath = fixturePath.appending("cache") @@ -280,7 +280,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testResolve() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") // Check that `resolve` works. @@ -291,7 +291,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testUpdate() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") // Perform an initial fetch. @@ -329,7 +329,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testCache() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let repositoriesPath = packageRoot.appending(components: ".build", "repositories") let cachePath = fixturePath.appending("cache") @@ -361,7 +361,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testDescribe() async throws { - try await fixture(name: "Miscellaneous/ExeTest") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/ExeTest") { fixturePath in // Generate the JSON description. let (jsonOutput, _) = try await self.execute(["describe", "--type=json"], packagePath: fixturePath) let json = try JSON(bytes: ByteString(encodingAsUTF8: jsonOutput)) @@ -374,7 +374,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { XCTAssertEqual(jsonTarget1["product_memberships"]?.array?[0].stringValue, "Exe") } - try await fixture(name: "CFamilyTargets/SwiftCMixed") { fixturePath in + try await fixtureXCTest(name: "CFamilyTargets/SwiftCMixed") { fixturePath in // Generate the JSON description. let (jsonOutput, _) = try await self.execute(["describe", "--type=json"], packagePath: fixturePath) let json = try JSON(bytes: ByteString(encodingAsUTF8: jsonOutput)) @@ -460,7 +460,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { func testDescribeJson() async throws { try XCTSkipOnWindows(because: "TSCBasic/Path.swift:969: Assertion failed, https://github.com/swiftlang/swift-package-manager/issues/8602") - try await fixture(name: "DependencyResolution/External/Simple/Bar") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple/Bar") { fixturePath in // Generate the JSON description. let (jsonOutput, _) = try await self.execute(["describe", "--type=json"], packagePath: fixturePath) let json = try JSON(bytes: ByteString(encodingAsUTF8: jsonOutput)) @@ -476,7 +476,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testDescribePackageUsingPlugins() async throws { - try await fixture(name: "Miscellaneous/Plugins/MySourceGenPlugin") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/MySourceGenPlugin") { fixturePath in // Generate the JSON description. let (stdout, _) = try await self.execute(["describe", "--type=json"], packagePath: fixturePath) let json = try JSON(bytes: ByteString(encodingAsUTF8: stdout)) @@ -494,7 +494,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testDumpPackage() async throws { - try await fixture(name: "DependencyResolution/External/Complex") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Complex") { fixturePath in let packageRoot = fixturePath.appending("app") let (dumpOutput, _) = try await execute(["dump-package"], packagePath: packageRoot) let json = try JSON(bytes: ByteString(encodingAsUTF8: dumpOutput)) @@ -562,7 +562,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { try XCTSkipIf(buildSystemProvider == .native && (try? UserToolchain.default.getSymbolGraphExtract()) == nil, "skipping test because the `swift-symbolgraph-extract` tools isn't available") try XCTSkipIf(buildSystemProvider == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows, "skipping test for Windows because of long file path issues") - try await fixture(name: "DependencyResolution/Internal/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/Internal/Simple") { fixturePath in let compactGraphData = try await XCTAsyncUnwrap(await symbolGraph(atPath: fixturePath, withPrettyPrinting: false)) let compactJSONText = String(decoding: compactGraphData, as: UTF8.self) XCTAssertEqual(compactJSONText.components(separatedBy: .newlines).count, 1) @@ -574,7 +574,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { try XCTSkipIf((try? UserToolchain.default.getSymbolGraphExtract()) == nil, "skipping test because the `swift-symbolgraph-extract` tools isn't available") try XCTSkipIf(buildSystemProvider == .swiftbuild, "skipping test because pretty printing isn't yet supported with swiftbuild build system via swift build and the swift compiler") - try await fixture(name: "DependencyResolution/Internal/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/Internal/Simple") { fixturePath in let prettyGraphData = try await XCTAsyncUnwrap(await symbolGraph(atPath: fixturePath, withPrettyPrinting: true)) let prettyJSONText = String(decoding: prettyGraphData, as: UTF8.self) XCTAssertGreaterThan(prettyJSONText.components(separatedBy: .newlines).count, 1) @@ -582,35 +582,35 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testCompletionToolListSnippets() async throws { - try await fixture(name: "Miscellaneous/Plugins/PluginsAndSnippets") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/PluginsAndSnippets") { fixturePath in let result = try await execute(["completion-tool", "list-snippets"], packagePath: fixturePath) XCTAssertEqual(result.stdout, "MySnippet\n") } } func testCompletionToolListDependencies() async throws { - try await fixture(name: "DependencyResolution/External/Complex") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Complex") { fixturePath in let result = try await execute(["completion-tool", "list-dependencies"], packagePath: fixturePath.appending("deck-of-playing-cards-local")) XCTAssertEqual(result.stdout, "playingcard\nfisheryates\n") } } func testCompletionToolListExecutables() async throws { - try await fixture(name: "Miscellaneous/MultipleExecutables") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/MultipleExecutables") { fixturePath in let result = try await execute(["completion-tool", "list-executables"], packagePath: fixturePath) XCTAssertEqual(result.stdout, "exec1\nexec2\n") } } func testCompletionToolListExecutablesDifferentNames() async throws { - try await fixture(name: "Miscellaneous/DifferentProductTargetName") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/DifferentProductTargetName") { fixturePath in let result = try await execute(["completion-tool", "list-executables"], packagePath: fixturePath) XCTAssertEqual(result.stdout, "Foo\n") } } func testShowExecutables() async throws { - try await fixture(name: "Miscellaneous/ShowExecutables") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/ShowExecutables") { fixturePath in let packageRoot = fixturePath.appending("app") let (textOutput, _) = try await self.execute(["show-executables", "--format=flatlist"], packagePath: packageRoot) XCTAssert(textOutput.contains("dealer\n")) @@ -645,7 +645,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testShowDependencies() async throws { - try await fixture(name: "DependencyResolution/External/Complex") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Complex") { fixturePath in let packageRoot = fixturePath.appending("app") let (textOutput, _) = try await self.execute(["show-dependencies", "--format=text"], packagePath: packageRoot) XCTAssert(textOutput.contains("FisherYates@1.2.3")) @@ -1418,7 +1418,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testPackageEditAndUnedit() async throws { - try await fixture(name: "Miscellaneous/PackageEdit") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/PackageEdit") { fixturePath in let fooPath = fixturePath.appending("foo") func build() async throws -> (stdout: String, stderr: String) { return try await executeSwiftBuild(fooPath) @@ -1497,7 +1497,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testPackageClean() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") // Build it. @@ -1516,7 +1516,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testPackageReset() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") // Build it. @@ -1541,7 +1541,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testResolvingBranchAndRevision() async throws { - try await fixture(name: "Miscellaneous/PackageEdit") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/PackageEdit") { fixturePath in let fooPath = fixturePath.appending("foo") @discardableResult @@ -1597,7 +1597,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testPackageResolved() async throws { - try await fixture(name: "Miscellaneous/PackageEdit") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/PackageEdit") { fixturePath in let fooPath = fixturePath.appending("foo") let exec = [fooPath.appending( components: ".build", @@ -2080,7 +2080,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { try XCTSkipIf(true, "skipping on non-macOS") #endif - try await fixture(name: "ValidLayouts/SingleModule") { fixturePath in + try await fixtureXCTest(name: "ValidLayouts/SingleModule") { fixturePath in try await testWithTemporaryDirectory { tmpdir in // Create fake `xcrun` and `sandbox-exec` commands. let fakeBinDir = tmpdir @@ -2167,7 +2167,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { ) func doMigration(featureName: String, expectedSummary: String) async throws { - try await fixture(name: "SwiftMigrate/\(featureName)Migration") { fixturePath in + try await fixtureXCTest(name: "SwiftMigrate/\(featureName)Migration") { fixturePath in let sourcePaths: [AbsolutePath] let fixedSourcePaths: [AbsolutePath] @@ -2218,7 +2218,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { "skipping because test environment compiler doesn't support `-print-supported-features`" ) - try await fixture(name: "SwiftMigrate/ExistentialAnyWithPluginMigration") { fixturePath in + try await fixtureXCTest(name: "SwiftMigrate/ExistentialAnyWithPluginMigration") { fixturePath in let (stdout, _) = try await self.execute( ["migrate", "--to-feature", "ExistentialAny"], packagePath: fixturePath @@ -2239,7 +2239,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { "skipping because test environment compiler doesn't support `-print-supported-features`" ) - try await fixture(name: "SwiftMigrate/ExistentialAnyWithCommonPluginDependencyMigration") { fixturePath in + try await fixtureXCTest(name: "SwiftMigrate/ExistentialAnyWithCommonPluginDependencyMigration") { fixturePath in let (stdout, _) = try await self.execute( ["migrate", "--to-feature", "ExistentialAny"], packagePath: fixturePath @@ -2256,7 +2256,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { "skipping because test environment compiler doesn't support `-print-supported-features`" ) - try await fixture(name: "SwiftMigrate/UpdateManifest") { fixturePath in + try await fixtureXCTest(name: "SwiftMigrate/UpdateManifest") { fixturePath in _ = try await self.execute( [ "migrate", @@ -2285,7 +2285,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { "skipping because test environment compiler doesn't support `-print-supported-features`" ) - try await fixture(name: "SwiftMigrate/UpdateManifest") { fixturePath in + try await fixtureXCTest(name: "SwiftMigrate/UpdateManifest") { fixturePath in _ = try await self.execute( [ "migrate", @@ -2313,7 +2313,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { "skipping because test environment compiler doesn't support `-print-supported-features`" ) - try await fixture(name: "SwiftMigrate/UpdateManifest") { fixturePath in + try await fixtureXCTest(name: "SwiftMigrate/UpdateManifest") { fixturePath in try await XCTAssertThrowsCommandExecutionError( await self.execute( ["migrate", "--to-feature", "ExistentialAny,InferIsolatedConformances,StrictMemorySafety"], @@ -2524,7 +2524,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } func testArchiveSource() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") // Running without arguments or options @@ -2841,7 +2841,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { // Only run the test if the environment in which we're running actually supports Swift concurrency (which the plugin APIs require). try XCTSkipIf(!UserToolchain.default.supportsSwiftConcurrency(), "skipping because test environment doesn't support concurrency") - try await fixture(name: "Miscellaneous/Plugins/AmbiguousCommands") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/AmbiguousCommands") { fixturePath in let (stdout, _) = try await self.execute(["plugin", "--package", "A", "A"], packagePath: fixturePath) XCTAssertMatch(stdout, .contains("Hello A!")) } @@ -2862,7 +2862,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { let containsWarning = StringPattern.contains("command plugin: Diagnostics.warning") let containsError = StringPattern.contains("command plugin: Diagnostics.error") - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in func runPlugin(flags: [String], diagnostics: [String], completion: (String, String) -> Void) async throws { let (stdout, stderr) = try await self.execute(flags + ["print-diagnostics"] + diagnostics, packagePath: fixturePath, env: ["SWIFT_DRIVER_SWIFTSCAN_LIB" : "/this/is/a/bad/path"]) completion(stdout, stderr) @@ -3020,35 +3020,35 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } // By default, a plugin-requested build produces a debug binary - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let _ = try await self.execute(["-c", "release", "build-target"], packagePath: fixturePath) AssertIsExecutableFile(fixturePath.appending(components: debugTarget)) AssertNotExists(fixturePath.appending(components: releaseTarget)) } // If the plugin specifies a debug binary, that is what will be built, regardless of overall configuration - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let _ = try await self.execute(["-c", "release", "build-target", "build-debug"], packagePath: fixturePath) AssertIsExecutableFile(fixturePath.appending(components: debugTarget)) AssertNotExists(fixturePath.appending(components: releaseTarget)) } // If the plugin requests a release binary, that is what will be built, regardless of overall configuration - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let _ = try await self.execute(["-c", "debug", "build-target", "build-release"], packagePath: fixturePath) AssertNotExists(fixturePath.appending(components: debugTarget)) AssertIsExecutableFile(fixturePath.appending(components: releaseTarget)) } // If the plugin inherits the overall build configuration, that is what will be built - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let _ = try await self.execute(["-c", "debug", "build-target", "build-inherit"], packagePath: fixturePath) AssertIsExecutableFile(fixturePath.appending(components: debugTarget)) AssertNotExists(fixturePath.appending(components: releaseTarget)) } // If the plugin inherits the overall build configuration, that is what will be built - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let _ = try await self.execute(["-c", "release", "build-target", "build-inherit"], packagePath: fixturePath) AssertNotExists(fixturePath.appending(components: debugTarget)) AssertIsExecutableFile(fixturePath.appending(components: releaseTarget)) @@ -3060,27 +3060,27 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { // Plugin arguments: check-testability // Overall configuration: debug, plugin build request: debug -> without testability - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in await XCTAssertAsyncNoThrow(try await self.execute(["-c", "debug", "check-testability", "InternalModule", "debug", "true"], packagePath: fixturePath)) } // Overall configuration: debug, plugin build request: release -> without testability - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in await XCTAssertAsyncNoThrow(try await self.execute(["-c", "debug", "check-testability", "InternalModule", "release", "false"], packagePath: fixturePath)) } // Overall configuration: release, plugin build request: debug -> with testability - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in await XCTAssertAsyncNoThrow(try await self.execute(["-c", "release", "check-testability", "InternalModule", "debug", "true"], packagePath: fixturePath)) } // Overall configuration: release, plugin build request: release -> with testability - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in await XCTAssertAsyncNoThrow(try await self.execute(["-c", "release", "check-testability", "InternalModule", "release", "false"], packagePath: fixturePath)) } // Overall configuration: release, plugin build request: release including tests -> with testability - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in await XCTAssertAsyncNoThrow(try await self.execute(["-c", "release", "check-testability", "all-with-tests", "release", "true"], packagePath: fixturePath)) } } @@ -3105,7 +3105,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { // otherwise the logs may be different in subsequent tests. // Check than nothing is echoed when echoLogs is false - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let (stdout, stderr) = try await self.execute(["print-diagnostics", "build"], packagePath: fixturePath, env: ["SWIFT_DRIVER_SWIFTSCAN_LIB" : "/this/is/a/bad/path"]) XCTAssertMatch(stdout, isEmpty) // Filter some unrelated output that could show up on stderr. @@ -3116,7 +3116,7 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } // Check that logs are returned to the plugin when echoLogs is false - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let (stdout, stderr) = try await self.execute(["print-diagnostics", "build", "printlogs"], packagePath: fixturePath, env: ["SWIFT_DRIVER_SWIFTSCAN_LIB" : "/this/is/a/bad/path"]) XCTAssertMatch(stdout, containsLogtext) // Filter some unrelated output that could show up on stderr. @@ -3127,14 +3127,14 @@ class PackageCommandTestCase: CommandsBuildProviderTestCase { } // Check that logs echoed to the console (on stderr) when echoLogs is true - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let (stdout, stderr) = try await self.execute(["print-diagnostics", "build", "echologs"], packagePath: fixturePath, env: ["SWIFT_DRIVER_SWIFTSCAN_LIB" : "/this/is/a/bad/path"]) XCTAssertMatch(stdout, isEmpty) XCTAssertMatch(stderr, containsLogecho) } // Check that logs are returned to the plugin and echoed to the console (on stderr) when echoLogs is true - try await fixture(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Plugins/CommandPluginTestStub") { fixturePath in let (stdout, stderr) = try await self.execute(["print-diagnostics", "build", "printlogs", "echologs"], packagePath: fixturePath, env: ["SWIFT_DRIVER_SWIFTSCAN_LIB" : "/this/is/a/bad/path"]) XCTAssertMatch(stdout, containsLogtext) XCTAssertMatch(stderr, containsLogecho) diff --git a/Tests/CommandsTests/PackageRegistryCommandTests.swift b/Tests/CommandsTests/PackageRegistryCommandTests.swift index b53efb7a8ac..b4f190f9cf3 100644 --- a/Tests/CommandsTests/PackageRegistryCommandTests.swift +++ b/Tests/CommandsTests/PackageRegistryCommandTests.swift @@ -89,7 +89,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { } func testLocalConfiguration() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let configurationFilePath = AbsolutePath( ".swiftpm/configuration/registries.json", @@ -202,7 +202,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { // TODO: Test global configuration func testSetMissingURL() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let configurationFilePath = AbsolutePath( ".swiftpm/configuration/registries.json", @@ -219,7 +219,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { } func testSetInvalidURL() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let configurationFilePath = AbsolutePath( ".swiftpm/configuration/registries.json", @@ -236,7 +236,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { } func testSetInsecureURL() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let configurationFilePath = AbsolutePath( ".swiftpm/configuration/registries.json", @@ -253,7 +253,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { } func testSetAllowedInsecureURL() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let configurationFilePath = AbsolutePath( ".swiftpm/configuration/registries.json", @@ -270,7 +270,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { } func testSetInvalidScope() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let configurationFilePath = AbsolutePath( ".swiftpm/configuration/registries.json", @@ -292,7 +292,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { } func testUnsetMissingEntry() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let packageRoot = fixturePath.appending("Bar") let configurationFilePath = AbsolutePath( ".swiftpm/configuration/registries.json", @@ -792,7 +792,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { let intermediateCertificatePath = temporaryDirectory.appending(component: "intermediate.cer") let privateKeyPath = temporaryDirectory.appending(component: "private-key.p8") - try fixture(name: "Signing", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Signing", createGitRepo: false) { fixturePath in try localFileSystem.copy( from: fixturePath.appending(components: "Certificates", "Test_ec.cer"), to: certificatePath @@ -903,7 +903,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { let intermediateCertificatePath = temporaryDirectory.appending(component: "intermediate.cer") let privateKeyPath = temporaryDirectory.appending(component: "private-key.p8") - try fixture(name: "Signing", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Signing", createGitRepo: false) { fixturePath in try localFileSystem.copy( from: fixturePath.appending(components: "Certificates", "Test_ec.cer"), to: certificatePath @@ -1010,7 +1010,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { let intermediateCertificatePath = temporaryDirectory.appending(component: "intermediate.cer") let privateKeyPath = temporaryDirectory.appending(component: "private-key.p8") - try fixture(name: "Signing", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Signing", createGitRepo: false) { fixturePath in try localFileSystem.copy( from: fixturePath.appending(components: "Certificates", "Test_ec.cer"), to: certificatePath @@ -1120,7 +1120,7 @@ final class PackageRegistryCommandTests: CommandsTestCase { } private func testRoots() throws -> [[UInt8]] { - try fixture(name: "Signing", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Signing", createGitRepo: false) { fixturePath in let rootCA = try localFileSystem .readFileContents(fixturePath.appending(components: "Certificates", "TestRootCA.cer")).contents return [rootCA] diff --git a/Tests/CommandsTests/SwiftCommandStateTests.swift b/Tests/CommandsTests/SwiftCommandStateTests.swift index 5ee582d18bf..266f8faebfe 100644 --- a/Tests/CommandsTests/SwiftCommandStateTests.swift +++ b/Tests/CommandsTests/SwiftCommandStateTests.swift @@ -30,7 +30,7 @@ import var TSCBasic.stderrStream final class SwiftCommandStateTests: CommandsTestCase { func testSeverityEnum() async throws { - try fixture(name: "Miscellaneous/Simple") { _ in + try fixtureXCTest(name: "Miscellaneous/Simple") { _ in do { let info = Diagnostic(severity: .info, message: "info-string", metadata: nil) @@ -59,7 +59,7 @@ final class SwiftCommandStateTests: CommandsTestCase { } func testVerbosityLogLevel() async throws { - try fixture(name: "Miscellaneous/Simple") { fixturePath in + try fixtureXCTest(name: "Miscellaneous/Simple") { fixturePath in do { let outputStream = BufferedOutputByteStream() let options = try GlobalOptions.parse(["--package-path", fixturePath.pathString]) @@ -196,7 +196,7 @@ final class SwiftCommandStateTests: CommandsTestCase { } func testAuthorizationProviders() async throws { - try fixture(name: "DependencyResolution/External/XCFramework") { fixturePath in + try fixtureXCTest(name: "DependencyResolution/External/XCFramework") { fixturePath in let fs = localFileSystem // custom .netrc file @@ -231,7 +231,7 @@ final class SwiftCommandStateTests: CommandsTestCase { } func testRegistryAuthorizationProviders() async throws { - try fixture(name: "DependencyResolution/External/XCFramework") { fixturePath in + try fixtureXCTest(name: "DependencyResolution/External/XCFramework") { fixturePath in let fs = localFileSystem // custom .netrc file diff --git a/Tests/CommandsTests/SwiftSDKCommandTests.swift b/Tests/CommandsTests/SwiftSDKCommandTests.swift index aba11289047..a8a19433491 100644 --- a/Tests/CommandsTests/SwiftSDKCommandTests.swift +++ b/Tests/CommandsTests/SwiftSDKCommandTests.swift @@ -49,7 +49,7 @@ final class SwiftSDKCommandTests: CommandsTestCase { func testInstallSubcommand() async throws { for command in [SwiftPM.sdk, SwiftPM.experimentalSDK] { - try await fixture(name: "SwiftSDKs") { fixturePath in + try await fixtureXCTest(name: "SwiftSDKs") { fixturePath in for bundle in ["test-sdk.artifactbundle.tar.gz", "test-sdk.artifactbundle.zip"] { var (stdout, stderr) = try await command.execute( [ @@ -138,7 +138,7 @@ final class SwiftSDKCommandTests: CommandsTestCase { """ for command in [SwiftPM.sdk, SwiftPM.experimentalSDK] { - try await fixture(name: "SwiftSDKs") { fixturePath in + try await fixtureXCTest(name: "SwiftSDKs") { fixturePath in let bundle = "test-sdk.artifactbundle.zip" var (stdout, stderr) = try await command.execute([ diff --git a/Tests/FunctionalPerformanceTests/BuildPerfTests.swift b/Tests/FunctionalPerformanceTests/BuildPerfTests.swift index 5fbc5ebd8ae..efe4333716a 100644 --- a/Tests/FunctionalPerformanceTests/BuildPerfTests.swift +++ b/Tests/FunctionalPerformanceTests/BuildPerfTests.swift @@ -60,7 +60,7 @@ // } // // func runFullBuildTest(for name: String, app appString: String? = nil, product productString: String) throws { -// try fixture(name: name) { fixturePath in +// try fixtureXCTest(name: name) { fixturePath in // let app = fixturePath.appending(components: (appString ?? "")) // let triple = try UserToolchain.default.targetTriple // let product = app.appending(components: ".build", triple.platformBuildPathComponent, "debug", productString) @@ -74,7 +74,7 @@ // } // // func runNullBuildTest(for name: String, app appString: String? = nil, product productString: String) throws { -// try fixture(name: name) { fixturePath in +// try fixtureXCTest(name: name) { fixturePath in // let app = fixturePath.appending(components: (appString ?? "")) // let triple = try UserToolchain.default.targetTriple // let product = app.appending(components: ".build", triple.platformBuildPathComponent, "debug", productString) diff --git a/Tests/FunctionalTests/CFamilyTargetTests.swift b/Tests/FunctionalTests/CFamilyTargetTests.swift index 7f7b5c92245..ae494371322 100644 --- a/Tests/FunctionalTests/CFamilyTargetTests.swift +++ b/Tests/FunctionalTests/CFamilyTargetTests.swift @@ -36,7 +36,7 @@ private func XCTAssertDirectoryContainsFile(dir: AbsolutePath, filename: String, final class CFamilyTargetTestCase: XCTestCase { func testCLibraryWithSpaces() async throws { - try await fixture(name: "CFamilyTargets/CLibraryWithSpaces") { fixturePath in + try await fixtureXCTest(name: "CFamilyTargets/CLibraryWithSpaces") { fixturePath in await XCTAssertBuilds(fixturePath) let debugPath = fixturePath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") XCTAssertDirectoryContainsFile(dir: debugPath, filename: "Bar.c.o") @@ -45,7 +45,7 @@ final class CFamilyTargetTestCase: XCTestCase { } func testCUsingCAndSwiftDep() async throws { - try await fixture(name: "DependencyResolution/External/CUsingCDep") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/CUsingCDep") { fixturePath in let packageRoot = fixturePath.appending("Bar") await XCTAssertBuilds(packageRoot) let debugPath = fixturePath.appending(components: "Bar", ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") @@ -57,7 +57,7 @@ final class CFamilyTargetTestCase: XCTestCase { } func testModuleMapGenerationCases() async throws { - try await fixture(name: "CFamilyTargets/ModuleMapGenerationCases") { fixturePath in + try await fixtureXCTest(name: "CFamilyTargets/ModuleMapGenerationCases") { fixturePath in await XCTAssertBuilds(fixturePath) let debugPath = fixturePath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") XCTAssertDirectoryContainsFile(dir: debugPath, filename: "Jaz.c.o") @@ -68,7 +68,7 @@ final class CFamilyTargetTestCase: XCTestCase { } func testNoIncludeDirCheck() async throws { - try await fixture(name: "CFamilyTargets/CLibraryNoIncludeDir") { fixturePath in + try await fixtureXCTest(name: "CFamilyTargets/CLibraryNoIncludeDir") { fixturePath in await XCTAssertAsyncThrowsError(try await executeSwiftBuild(fixturePath), "This build should throw an error") { err in // The err.localizedDescription doesn't capture the detailed error string so interpolate let errStr = "\(err)" @@ -80,7 +80,7 @@ final class CFamilyTargetTestCase: XCTestCase { func testCanForwardExtraFlagsToClang() async throws { // Try building a fixture which needs extra flags to be able to build. - try await fixture(name: "CFamilyTargets/CDynamicLookup") { fixturePath in + try await fixtureXCTest(name: "CFamilyTargets/CDynamicLookup") { fixturePath in await XCTAssertBuilds(fixturePath, Xld: ["-undefined", "dynamic_lookup"]) let debugPath = fixturePath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") XCTAssertDirectoryContainsFile(dir: debugPath, filename: "Foo.c.o") @@ -91,7 +91,7 @@ final class CFamilyTargetTestCase: XCTestCase { #if !os(macOS) try XCTSkipIf(true, "test is only supported on macOS") #endif - try await fixture(name: "CFamilyTargets/ObjCmacOSPackage") { fixturePath in + try await fixtureXCTest(name: "CFamilyTargets/ObjCmacOSPackage") { fixturePath in // Build the package. await XCTAssertBuilds(fixturePath) XCTAssertDirectoryContainsFile(dir: fixturePath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug"), filename: "HelloWorldExample.m.o") @@ -101,7 +101,7 @@ final class CFamilyTargetTestCase: XCTestCase { } func testCanBuildRelativeHeaderSearchPaths() async throws { - try await fixture(name: "CFamilyTargets/CLibraryParentSearchPath") { fixturePath in + try await fixtureXCTest(name: "CFamilyTargets/CLibraryParentSearchPath") { fixturePath in await XCTAssertBuilds(fixturePath) XCTAssertDirectoryContainsFile(dir: fixturePath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug"), filename: "HeaderInclude.swiftmodule") } diff --git a/Tests/FunctionalTests/DependencyResolutionTests.swift b/Tests/FunctionalTests/DependencyResolutionTests.swift index 2356aee5ef3..c0bc3981f7c 100644 --- a/Tests/FunctionalTests/DependencyResolutionTests.swift +++ b/Tests/FunctionalTests/DependencyResolutionTests.swift @@ -22,7 +22,7 @@ import enum TSCUtility.Git class DependencyResolutionTests: XCTestCase { func testInternalSimple() async throws { - try await fixture(name: "DependencyResolution/Internal/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/Internal/Simple") { fixturePath in await XCTAssertBuilds(fixturePath) let output = try await AsyncProcess.checkNonZeroExit(args: fixturePath.appending(components: ".build", UserToolchain.default.targetTriple.platformBuildPathComponent, "debug", "Foo").pathString).withSwiftLineEnding @@ -31,13 +31,13 @@ class DependencyResolutionTests: XCTestCase { } func testInternalExecAsDep() async throws { - try await fixture(name: "DependencyResolution/Internal/InternalExecutableAsDependency") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/Internal/InternalExecutableAsDependency") { fixturePath in await XCTAssertBuildFails(fixturePath) } } func testInternalComplex() async throws { - try await fixture(name: "DependencyResolution/Internal/Complex") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/Internal/Complex") { fixturePath in await XCTAssertBuilds(fixturePath) let output = try await AsyncProcess.checkNonZeroExit(args: fixturePath.appending(components: ".build", UserToolchain.default.targetTriple.platformBuildPathComponent, "debug", "Foo").pathString).withSwiftLineEnding @@ -47,7 +47,7 @@ class DependencyResolutionTests: XCTestCase { /// Check resolution of a trivial package with one dependency. func testExternalSimple() async throws { - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in // Add several other tags to check version selection. let repo = GitRepository(path: fixturePath.appending(components: "Foo")) for tag in ["1.1.0", "1.2.0"] { @@ -63,7 +63,7 @@ class DependencyResolutionTests: XCTestCase { } func testExternalComplex() async throws { - try await fixture(name: "DependencyResolution/External/Complex") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Complex") { fixturePath in await XCTAssertBuilds(fixturePath.appending("app")) let output = try await AsyncProcess.checkNonZeroExit(args: fixturePath.appending(components: "app", ".build", UserToolchain.default.targetTriple.platformBuildPathComponent, "debug", "Dealer").pathString).withSwiftLineEnding XCTAssertEqual(output, "♣︎K\n♣︎Q\n♣︎J\n♣︎10\n♣︎9\n♣︎8\n♣︎7\n♣︎6\n♣︎5\n♣︎4\n") @@ -71,7 +71,7 @@ class DependencyResolutionTests: XCTestCase { } func testConvenienceBranchInit() async throws { - try await fixture(name: "DependencyResolution/External/Branch") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Branch") { fixturePath in // Tests the convenience init .package(url: , branch: ) let app = fixturePath.appending("Bar") try await SwiftPM.Build.execute(packagePath: app) @@ -79,7 +79,7 @@ class DependencyResolutionTests: XCTestCase { } func testMirrors() async throws { - try await fixture(name: "DependencyResolution/External/Mirror") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Mirror") { fixturePath in let prefix = try resolveSymlinks(fixturePath) let appPath = prefix.appending("App") let packageResolvedPath = appPath.appending("Package.resolved") @@ -141,7 +141,7 @@ class DependencyResolutionTests: XCTestCase { } func testPackageLookupCaseInsensitive() async throws { - try await fixture(name: "DependencyResolution/External/PackageLookupCaseInsensitive") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/PackageLookupCaseInsensitive") { fixturePath in try await SwiftPM.Package.execute(["update"], packagePath: fixturePath.appending("pkg")) } } diff --git a/Tests/FunctionalTests/MacroTests.swift b/Tests/FunctionalTests/MacroTests.swift index edd50144902..2de1aa5e073 100644 --- a/Tests/FunctionalTests/MacroTests.swift +++ b/Tests/FunctionalTests/MacroTests.swift @@ -25,7 +25,7 @@ class MacroTests: XCTestCase { let libSwiftSyntaxMacrosPath = try UserToolchain.default.hostLibDir.appending("libSwiftSyntaxMacros.dylib") try XCTSkipIf(!localFileSystem.exists(libSwiftSyntaxMacrosPath), "test need `libSwiftSyntaxMacros` to exist in the host toolchain") - try fixture(name: "Macros") { fixturePath in + try fixtureXCTest(name: "Macros") { fixturePath in let (stdout, _) = try executeSwiftBuild(fixturePath.appending("MacroPackage"), configuration: .debug) XCTAssert(stdout.contains("@__swiftmacro_11MacroClient11fontLiteralfMf_.swift as Font"), "stdout:\n\(stdout)") XCTAssert(stdout.contains("Build complete!"), "stdout:\n\(stdout)") diff --git a/Tests/FunctionalTests/MiscellaneousTests.swift b/Tests/FunctionalTests/MiscellaneousTests.swift index d6647fe7b75..10ce6758909 100644 --- a/Tests/FunctionalTests/MiscellaneousTests.swift +++ b/Tests/FunctionalTests/MiscellaneousTests.swift @@ -27,7 +27,7 @@ final class MiscellaneousTestCase: XCTestCase { // verifies the stdout contains information about // the selected version of the package - try await fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let (stdout, stderr) = try await executeSwiftBuild(fixturePath.appending("Bar")) // package resolution output goes to stderr XCTAssertMatch(stderr, .regex("Computed .* at 1\\.2\\.3")) @@ -47,7 +47,7 @@ final class MiscellaneousTestCase: XCTestCase { // regression test to ensure that dependencies of other dependencies // are not passed into the build-command. - try await fixture(name: "Miscellaneous/ExactDependencies") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/ExactDependencies") { fixturePath in await XCTAssertBuilds(fixturePath.appending("app")) let buildDir = fixturePath.appending(components: "app", ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") XCTAssertFileExists(buildDir.appending(executableName("FooExec"))) @@ -61,7 +61,7 @@ final class MiscellaneousTestCase: XCTestCase { // subsequent executions to an unmodified source tree // should immediately exit with exit-status: `0` - try await fixture(name: "DependencyResolution/External/Complex") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Complex") { fixturePath in await XCTAssertBuilds(fixturePath.appending("app")) await XCTAssertBuilds(fixturePath.appending("app")) await XCTAssertBuilds(fixturePath.appending("app")) @@ -78,7 +78,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testCompileFailureExitsGracefully() async throws { - try await fixture(name: "Miscellaneous/CompileFails") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/CompileFails") { fixturePath in await XCTAssertThrowsCommandExecutionError(try await executeSwiftBuild(fixturePath)) { error in // if our code crashes we'll get an exit code of 256 guard error.result.exitStatus == .terminated(code: 1) else { @@ -92,7 +92,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testPackageManagerDefineAndXArgs() async throws { - try await fixture(name: "Miscellaneous/-DSWIFT_PACKAGE") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/-DSWIFT_PACKAGE") { fixturePath in await XCTAssertBuildFails(fixturePath) await XCTAssertBuilds(fixturePath, Xcc: ["-DEXTRA_C_DEFINE=2"], Xswiftc: ["-DEXTRA_SWIFTC_DEFINE"]) } @@ -103,7 +103,7 @@ final class MiscellaneousTestCase: XCTestCase { any executables that link to that module to be relinked. */ func testInternalDependencyEdges() async throws { - try await fixture(name: "Miscellaneous/DependencyEdges/Internal") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/DependencyEdges/Internal") { fixturePath in let execpath = fixturePath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug", "Foo").pathString await XCTAssertBuilds(fixturePath) @@ -127,7 +127,7 @@ final class MiscellaneousTestCase: XCTestCase { any executables that link to that module in the root package. */ func testExternalDependencyEdges1() async throws { - try await fixture(name: "DependencyResolution/External/Complex") { fixturePath in + try await fixtureXCTest(name: "DependencyResolution/External/Complex") { fixturePath in let execpath = fixturePath.appending(components: "app", ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug", "Dealer").pathString let packageRoot = fixturePath.appending("app") @@ -154,7 +154,7 @@ final class MiscellaneousTestCase: XCTestCase { any executables for another external package to be rebuilt. */ func testExternalDependencyEdges2() async throws { - try await fixture(name: "Miscellaneous/DependencyEdges/External") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/DependencyEdges/External") { fixturePath in let execpath = [fixturePath.appending(components: "root", ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug", "dep2").pathString] let packageRoot = fixturePath.appending("root") @@ -177,7 +177,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testSpaces() async throws { - try await fixture(name: "Miscellaneous/Spaces Fixture") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Spaces Fixture") { fixturePath in await XCTAssertBuilds(fixturePath) XCTAssertFileExists(fixturePath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug", "Module_Name_1.build", "Foo.swift.o")) } @@ -187,7 +187,7 @@ final class MiscellaneousTestCase: XCTestCase { // This has been failing on the Swift CI sometimes, need to investigate. #if false // Make sure that swiftpm doesn't rebuild second time if the modulemap is being generated. - try fixture(name: "CFamilyTargets/SwiftCMixed") { fixturePath in + try fixtureXCTest(name: "CFamilyTargets/SwiftCMixed") { fixturePath in var output = try await executeSwiftBuild(prefix) XCTAssertFalse(output.isEmpty, output) output = try await executeSwiftBuild(prefix) @@ -200,7 +200,7 @@ final class MiscellaneousTestCase: XCTestCase { #if !os(macOS) try XCTSkipIf(true, "test is only supported on macOS") #endif - try await fixture(name: "Miscellaneous/DistantFutureDeploymentTarget") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/DistantFutureDeploymentTarget") { fixturePath in let hostTriple = try UserToolchain.default.targetTriple try await executeSwiftBuild(fixturePath, Xswiftc: ["-target", "\(hostTriple.archName)-apple-macosx41.0"]) } @@ -208,7 +208,7 @@ final class MiscellaneousTestCase: XCTestCase { func testPkgConfigCFamilyTargets() async throws { try XCTSkipOnWindows(because: "fails to build on windows (maybe not be supported?)") - try await fixture(name: "Miscellaneous/PkgConfig") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/PkgConfig") { fixturePath in let systemModule = fixturePath.appending("SystemModule") // Create a shared library. let input = systemModule.appending(components: "Sources", "SystemModule.c") @@ -252,7 +252,7 @@ final class MiscellaneousTestCase: XCTestCase { func testCanKillSubprocessOnSigInt() throws { // swift-pm: Spurious? failures of MiscellaneousTestCase.testCanKillSubprocessOnSigInt on linux #if false - try fixture(name: "DependencyResolution/External/Simple") { fixturePath in + try fixtureXCTest(name: "DependencyResolution/External/Simple") { fixturePath in let fakeGit = fixturePath.appending(components: "bin", "git") let waitFile = fixturePath.appending(components: "waitfile") @@ -304,7 +304,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testReportingErrorFromGitCommand() async throws { - try await fixture(name: "Miscellaneous/MissingDependency") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/MissingDependency") { fixturePath in // This fixture has a setup that is intentionally missing a local // dependency to induce a failure. @@ -323,7 +323,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testLocalPackageUsedAsURLValidation() async throws { - try await fixture(name: "Miscellaneous/LocalPackageAsURL", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/LocalPackageAsURL", createGitRepo: false) { fixturePath in // This fixture has a setup that is trying to use a local package // as a url that hasn't been initialized as a repo await XCTAssertAsyncThrowsError(try await SwiftPM.Build.execute(packagePath: fixturePath.appending("Bar"))) { error in @@ -345,7 +345,7 @@ final class MiscellaneousTestCase: XCTestCase { // - https://github.com/swiftlang/swift/pull/69696 // - https://github.com/swiftlang/swift/pull/61766 // - https://github.com/swiftlang/swift-package-manager/pull/5842#issuecomment-1301632685 - try await fixture(name: "Miscellaneous/LTO/SwiftAndCTargets") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/LTO/SwiftAndCTargets") { fixturePath in /*let output =*/ try await executeSwiftBuild( fixturePath, @@ -362,7 +362,7 @@ final class MiscellaneousTestCase: XCTestCase { func testUnicode() async throws { try XCTSkipOnWindows(because: "Filepath too long error") #if !os(Linux) && !os(Android) // TODO: - Linux has trouble with this and needs investigation. - try await fixture(name: "Miscellaneous/Unicode") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Unicode") { fixturePath in // See the fixture manifest for an explanation of this string. let complicatedString = "πשּׁµ𝄞🇺🇳🇮🇱x̱̱̱̱̱̄̄̄̄̄" let verify = "\u{03C0}\u{0FB2C}\u{00B5}\u{1D11E}\u{1F1FA}\u{1F1F3}\u{1F1EE}\u{1F1F1}\u{0078}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}" @@ -397,7 +397,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testTestsCanLinkAgainstExecutable() async throws { - try await fixture(name: "Miscellaneous/TestableExe") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/TestableExe") { fixturePath in do { let (stdout, stderr) = try await executeSwiftTest(fixturePath) // in "swift test" build output goes to stderr @@ -429,7 +429,7 @@ final class MiscellaneousTestCase: XCTestCase { @available(macOS 15, *) func testTestsCanLinkAgainstAsyncExecutable() async throws { - try await fixture(name: "Miscellaneous/TestableAsyncExe") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/TestableAsyncExe") { fixturePath in let (stdout, stderr) = try await executeSwiftTest(fixturePath) // in "swift test" build output goes to stderr XCTAssertMatch(stderr, .contains("Linking TestableAsyncExe1")) @@ -448,7 +448,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testExecutableTargetMismatch() async throws { - try await fixture(name: "Miscellaneous/TargetMismatch") { path in + try await fixtureXCTest(name: "Miscellaneous/TargetMismatch") { path in do { let output = try await executeSwiftBuild(path) // in "swift build" build output goes to stdout @@ -461,7 +461,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testLibraryTriesToIncludeExecutableTarget() async throws { - try await fixture(name: "Miscellaneous/PackageWithMalformedLibraryProduct") { path in + try await fixtureXCTest(name: "Miscellaneous/PackageWithMalformedLibraryProduct") { path in await XCTAssertThrowsCommandExecutionError(try await executeSwiftBuild(path)) { error in // if our code crashes we'll get an exit code of 256 guard error.result.exitStatus == .terminated(code: 1) else { @@ -473,7 +473,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testEditModeEndToEnd() async throws { - try await fixture(name: "Miscellaneous/Edit") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/Edit") { fixturePath in #if os(Windows) let prefix = fixturePath #else @@ -529,7 +529,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testCustomCachePath() async throws { - try await fixture(name: "Miscellaneous/Simple") { path in + try await fixtureXCTest(name: "Miscellaneous/Simple") { path in let customCachePath = path.appending(components: "custom", "cache") XCTAssertNoSuchPath(customCachePath) try await SwiftPM.Build.execute(["--cache-path", customCachePath.pathString], packagePath: path) @@ -538,7 +538,7 @@ final class MiscellaneousTestCase: XCTestCase { // `FileSystem` does not support `chmod` on Linux #if os(macOS) - try await fixture(name: "Miscellaneous/Simple") { path in + try await fixtureXCTest(name: "Miscellaneous/Simple") { path in try localFileSystem.chmod(.userUnWritable, path: path) let customCachePath = path.appending(components: "custom", "cache") XCTAssertNoSuchPath(customCachePath) @@ -554,7 +554,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testCustomConfigPath() async throws { - try await fixture(name: "Miscellaneous/Simple") { path in + try await fixtureXCTest(name: "Miscellaneous/Simple") { path in let customConfigPath = path.appending(components: "custom", "config") XCTAssertNoSuchPath(customConfigPath) try await SwiftPM.Build.execute(["--config-path", customConfigPath.pathString], packagePath: path) @@ -563,7 +563,7 @@ final class MiscellaneousTestCase: XCTestCase { // `FileSystem` does not support `chmod` on Linux #if os(macOS) - try await fixture(name: "Miscellaneous/Simple") { path in + try await fixtureXCTest(name: "Miscellaneous/Simple") { path in try localFileSystem.chmod(.userUnWritable, path: path) let customConfigPath = path.appending(components: "custom", "config") XCTAssertNoSuchPath(customConfigPath) @@ -579,7 +579,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testCustomSecurityPath() async throws { - try await fixture(name: "Miscellaneous/Simple") { path in + try await fixtureXCTest(name: "Miscellaneous/Simple") { path in let customSecurityPath = path.appending(components: "custom", "security") XCTAssertNoSuchPath(customSecurityPath) try await SwiftPM.Build.execute(["--security-path", customSecurityPath.pathString], packagePath: path) @@ -588,7 +588,7 @@ final class MiscellaneousTestCase: XCTestCase { // `FileSystem` does not support `chmod` on Linux #if os(macOS) - try await fixture(name: "Miscellaneous/Simple") { path in + try await fixtureXCTest(name: "Miscellaneous/Simple") { path in try localFileSystem.chmod(.userUnWritable, path: path) let customSecurityPath = path.appending(components: "custom", "security") XCTAssertNoSuchPath(customSecurityPath) @@ -612,7 +612,7 @@ final class MiscellaneousTestCase: XCTestCase { skipPlatformCi: true, ) - try await fixture(name: "Miscellaneous/PluginGeneratedResources") { path in + try await fixtureXCTest(name: "Miscellaneous/PluginGeneratedResources") { path in let result = try await SwiftPM.Run.execute(packagePath: path) XCTAssertEqual(result.stdout, "Hello, World!\n", "executable did not produce expected output") XCTAssertTrue(result.stderr.contains("Copying best.txt\n"), "build log is missing message about copying resource file") @@ -620,13 +620,13 @@ final class MiscellaneousTestCase: XCTestCase { } func testCompileCXX17CrashWithFModules() async throws { - try await fixture(name: "Miscellaneous/CXX17CompilerCrash/v5_8") { fixturePath in + try await fixtureXCTest(name: "Miscellaneous/CXX17CompilerCrash/v5_8") { fixturePath in await XCTAssertBuilds(fixturePath) } } func testNoJSONOutputWithFlatPackageStructure() async throws { - try await fixture(name: "Miscellaneous/FlatPackage") { package in + try await fixtureXCTest(name: "Miscellaneous/FlatPackage") { package in // First build, make sure we got the `.build` directory where we expect it, and that there is no JSON output (by looking for known output). let (stdout1, stderr1) = try await SwiftPM.Build.execute(packagePath: package) XCTAssertDirectoryExists(package.appending(".build")) @@ -642,7 +642,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testNoWarningFromRemoteDependencies() async throws { - try await fixture(name: "Miscellaneous/DependenciesWarnings") { path in + try await fixtureXCTest(name: "Miscellaneous/DependenciesWarnings") { path in // prepare the deps as git sources let dependency1Path = path.appending("dep1") initGitRepo(dependency1Path, tag: "1.0.0") @@ -659,7 +659,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testNoWarningFromRemoteDependenciesWithWarningsAsErrors() async throws { - try await fixture(name: "Miscellaneous/DependenciesWarnings2") { path in + try await fixtureXCTest(name: "Miscellaneous/DependenciesWarnings2") { path in // prepare the deps as git sources let dependency1Path = path.appending("dep1") initGitRepo(dependency1Path, tag: "1.0.0") @@ -675,7 +675,7 @@ final class MiscellaneousTestCase: XCTestCase { } func testRootPackageWithConditionals() async throws { - try await fixture(name: "Miscellaneous/RootPackageWithConditionals") { path in + try await fixtureXCTest(name: "Miscellaneous/RootPackageWithConditionals") { path in let (_, stderr) = try await SwiftPM.Build.execute(packagePath: path, env: ["SWIFT_DRIVER_SWIFTSCAN_LIB" : "/this/is/a/bad/path"]) let errors = stderr.components(separatedBy: .newlines).filter { !$0.contains("[logging] misuse") && !$0.isEmpty } .filter { !$0.contains("Unable to locate libSwiftScan") } @@ -690,7 +690,7 @@ final class MiscellaneousTestCase: XCTestCase { throw XCTSkip("Skipping Swift Build testing on Amazon Linux because of platform issues.") } #endif - try await fixture(name: "Miscellaneous/RootPackageWithConditionals") { path in + try await fixtureXCTest(name: "Miscellaneous/RootPackageWithConditionals") { path in _ = try await SwiftPM.Build.execute(["--build-system=swiftbuild"], packagePath: path, env: ["SWIFT_DRIVER_SWIFTSCAN_LIB" : "/this/is/a/bad/path"]) } } diff --git a/Tests/FunctionalTests/ModuleAliasingFixtureTests.swift b/Tests/FunctionalTests/ModuleAliasingFixtureTests.swift index 77c180cfc58..1a1afd2d370 100644 --- a/Tests/FunctionalTests/ModuleAliasingFixtureTests.swift +++ b/Tests/FunctionalTests/ModuleAliasingFixtureTests.swift @@ -19,7 +19,7 @@ import XCTest final class ModuleAliasingFixtureTests: XCTestCase { func testModuleDirectDeps1() async throws { - try await fixture(name: "ModuleAliasing/DirectDeps1") { fixturePath in + try await fixtureXCTest(name: "ModuleAliasing/DirectDeps1") { fixturePath in let pkgPath = fixturePath.appending(components: "AppPkg") let buildPath = pkgPath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") await XCTAssertBuilds(pkgPath, extraArgs: ["--vv"]) @@ -31,7 +31,7 @@ final class ModuleAliasingFixtureTests: XCTestCase { } func testModuleDirectDeps2() async throws { - try await fixture(name: "ModuleAliasing/DirectDeps2") { fixturePath in + try await fixtureXCTest(name: "ModuleAliasing/DirectDeps2") { fixturePath in let pkgPath = fixturePath.appending(components: "AppPkg") let buildPath = pkgPath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") await XCTAssertBuilds(pkgPath, extraArgs: ["--vv"]) @@ -43,7 +43,7 @@ final class ModuleAliasingFixtureTests: XCTestCase { } func testModuleNestedDeps1() async throws { - try await fixture(name: "ModuleAliasing/NestedDeps1") { fixturePath in + try await fixtureXCTest(name: "ModuleAliasing/NestedDeps1") { fixturePath in let pkgPath = fixturePath.appending(components: "AppPkg") let buildPath = pkgPath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") await XCTAssertBuilds(pkgPath, extraArgs: ["--vv"]) @@ -59,7 +59,7 @@ final class ModuleAliasingFixtureTests: XCTestCase { } func testModuleNestedDeps2() async throws { - try await fixture(name: "ModuleAliasing/NestedDeps2") { fixturePath in + try await fixtureXCTest(name: "ModuleAliasing/NestedDeps2") { fixturePath in let pkgPath = fixturePath.appending(components: "AppPkg") let buildPath = pkgPath.appending(components: ".build", try UserToolchain.default.targetTriple.platformBuildPathComponent, "debug") await XCTAssertBuilds(pkgPath, extraArgs: ["--vv"]) diff --git a/Tests/FunctionalTests/ModuleMapTests.swift b/Tests/FunctionalTests/ModuleMapTests.swift index 64ae7bd123b..e209363a0b7 100644 --- a/Tests/FunctionalTests/ModuleMapTests.swift +++ b/Tests/FunctionalTests/ModuleMapTests.swift @@ -18,13 +18,13 @@ import Workspace import XCTest final class ModuleMapsTestCase: XCTestCase { - private func fixture( + private func fixtureXCTest( name: String, cModuleName: String, rootpkg: String, body: @escaping (AbsolutePath, [String]) async throws -> Void ) async throws { - try await _InternalTestSupport.fixture(name: name) { fixturePath in + try await _InternalTestSupport.fixtureXCTest(name: name) { fixturePath in let input = fixturePath.appending(components: cModuleName, "C", "foo.c") let triple = try UserToolchain.default.targetTriple let outdir = fixturePath.appending(components: rootpkg, ".build", triple.platformBuildPathComponent, "debug") @@ -43,7 +43,7 @@ final class ModuleMapsTestCase: XCTestCase { func testDirectDependency() async throws { try XCTSkipOnWindows(because: "fails to build on windows (maybe not supported?)") - try await fixture(name: "ModuleMaps/Direct", cModuleName: "CFoo", rootpkg: "App") { fixturePath, Xld in + try await fixtureXCTest(name: "ModuleMaps/Direct", cModuleName: "CFoo", rootpkg: "App") { fixturePath, Xld in await XCTAssertBuilds(fixturePath.appending("App"), Xld: Xld) let triple = try UserToolchain.default.targetTriple @@ -61,7 +61,7 @@ final class ModuleMapsTestCase: XCTestCase { func testTransitiveDependency() async throws { try XCTSkipOnWindows(because: "fails to build on windows (maybe not supported?)") - try await fixture(name: "ModuleMaps/Transitive", cModuleName: "packageD", rootpkg: "packageA") { fixturePath, Xld in + try await fixtureXCTest(name: "ModuleMaps/Transitive", cModuleName: "packageD", rootpkg: "packageA") { fixturePath, Xld in await XCTAssertBuilds(fixturePath.appending("packageA"), Xld: Xld) func verify(_ conf: String) async throws { diff --git a/Tests/FunctionalTests/ResourcesTests.swift b/Tests/FunctionalTests/ResourcesTests.swift index a010a7eebb0..65359392c79 100644 --- a/Tests/FunctionalTests/ResourcesTests.swift +++ b/Tests/FunctionalTests/ResourcesTests.swift @@ -24,7 +24,7 @@ final class ResourcesTests: XCTestCase { skipPlatformCi: true, ) - try await fixture(name: "Resources/Simple") { fixturePath in + try await fixtureXCTest(name: "Resources/Simple") { fixturePath in var executables = ["SwiftyResource"] // Objective-C module requires macOS @@ -41,7 +41,7 @@ final class ResourcesTests: XCTestCase { } func testLocalizedResources() async throws { - try await fixture(name: "Resources/Localized") { fixturePath in + try await fixtureXCTest(name: "Resources/Localized") { fixturePath in try await executeSwiftBuild(fixturePath) let exec = AbsolutePath(".build/debug/exe", relativeTo: fixturePath) @@ -62,13 +62,13 @@ final class ResourcesTests: XCTestCase { try XCTSkipIf(true, "test is only supported on macOS") #endif - try await fixture(name: "Resources/Simple") { fixturePath in + try await fixtureXCTest(name: "Resources/Simple") { fixturePath in await XCTAssertBuilds(fixturePath, extraArgs: ["--target", "MixedClangResource"]) } } func testMovedBinaryResources() async throws { - try await fixture(name: "Resources/Moved") { fixturePath in + try await fixtureXCTest(name: "Resources/Moved") { fixturePath in var executables = ["SwiftyResource"] // Objective-C module requires macOS @@ -109,7 +109,7 @@ final class ResourcesTests: XCTestCase { func testSwiftResourceAccessorDoesNotCauseInconsistentImportWarning() async throws { try XCTSkipOnWindows(because: "fails to build, need investigation") - try await fixture(name: "Resources/FoundationlessClient/UtilsWithFoundationPkg") { fixturePath in + try await fixtureXCTest(name: "Resources/FoundationlessClient/UtilsWithFoundationPkg") { fixturePath in await XCTAssertBuilds( fixturePath, Xswiftc: ["-warnings-as-errors"] @@ -123,13 +123,13 @@ final class ResourcesTests: XCTestCase { try XCTSkipIf(true, "test is only supported on macOS") #endif - try await fixture(name: "Resources/Simple") { fixturePath in + try await fixtureXCTest(name: "Resources/Simple") { fixturePath in await XCTAssertSwiftTest(fixturePath, extraArgs: ["--filter", "ClangResourceTests"]) } } func testResourcesEmbeddedInCode() async throws { - try await fixture(name: "Resources/EmbedInCodeSimple") { fixturePath in + try await fixtureXCTest(name: "Resources/EmbedInCodeSimple") { fixturePath in let execPath = fixturePath.appending(components: ".build", "debug", "EmbedInCodeSimple") try await executeSwiftBuild(fixturePath) let result = try await AsyncProcess.checkNonZeroExit(args: execPath.pathString) diff --git a/Tests/PackageCollectionsSigningTests/CertificatePolicyTests.swift b/Tests/PackageCollectionsSigningTests/CertificatePolicyTests.swift index 9c72f20ede5..e5d4abdcf7b 100644 --- a/Tests/PackageCollectionsSigningTests/CertificatePolicyTests.swift +++ b/Tests/PackageCollectionsSigningTests/CertificatePolicyTests.swift @@ -570,7 +570,7 @@ class CertificatePolicyTests: XCTestCase { private func readTestCertChain(paths: (AbsolutePath) -> [AbsolutePath]) async throws -> [Certificate] { try await withCheckedThrowingContinuation { continuation in do { - try fixture(name: "Signing", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Signing", createGitRepo: false) { fixturePath in let certPaths = paths(fixturePath) let certificates = try certPaths.map { certPath in try Certificate(derEncoded: try localFileSystem.readFileContents(certPath).contents) diff --git a/Tests/PackageCollectionsSigningTests/PackageCollectionSigningTests.swift b/Tests/PackageCollectionsSigningTests/PackageCollectionSigningTests.swift index a6979af056c..89ed50aacc1 100644 --- a/Tests/PackageCollectionsSigningTests/PackageCollectionSigningTests.swift +++ b/Tests/PackageCollectionsSigningTests/PackageCollectionSigningTests.swift @@ -22,7 +22,7 @@ import XCTest class PackageCollectionSigningTests: XCTestCase { func test_RSA_signAndValidate_happyCase() async throws { try await withTemporaryDirectory { tmp in - let collection = try await self.readTestPackageCollection() + let collection: PackageCollectionModel.V1.Collection = try await self.readTestPackageCollection() let (certPaths, privateKeyPath) = try await self.copyTestCertChainAndKey( certPaths: { fixturePath in [ @@ -707,7 +707,7 @@ class PackageCollectionSigningTests: XCTestCase { private func readTestPackageCollection() async throws -> PackageCollectionModel.V1.Collection { try await withCheckedThrowingContinuation { continuation in do { - try fixture(name: "Collections", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let jsonDecoder = JSONDecoder.makeWithDefaults() let collectionPath = fixturePath.appending(components: "JSON", "good.json") let collectionData: Data = try localFileSystem.readFileContents(collectionPath) @@ -730,7 +730,7 @@ class PackageCollectionSigningTests: XCTestCase { ) async throws -> ([AbsolutePath], AbsolutePath) { try await withCheckedThrowingContinuation { continuation in do { - try fixture(name: "Signing", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Signing", createGitRepo: false) { fixturePath in let certSourcePaths = certPaths(fixturePath) let certDirectoryPath = tmpDirectoryPath.appending("Certificates") diff --git a/Tests/PackageCollectionsSigningTests/SignatureTests.swift b/Tests/PackageCollectionsSigningTests/SignatureTests.swift index 6792d4d956f..17fe5839c18 100644 --- a/Tests/PackageCollectionsSigningTests/SignatureTests.swift +++ b/Tests/PackageCollectionsSigningTests/SignatureTests.swift @@ -157,7 +157,7 @@ class SignatureTests: XCTestCase { private func readTestCertData(path: (AbsolutePath) -> AbsolutePath) async throws -> Data { try await withCheckedThrowingContinuation { continuation in do { - try fixture(name: "Signing", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Signing", createGitRepo: false) { fixturePath in let certPath = path(fixturePath) let certData: Data = try localFileSystem.readFileContents(certPath) continuation.resume(returning: certData) diff --git a/Tests/PackageCollectionsTests/GitHubPackageMetadataProviderTests.swift b/Tests/PackageCollectionsTests/GitHubPackageMetadataProviderTests.swift index b110c7db810..d29033ce597 100644 --- a/Tests/PackageCollectionsTests/GitHubPackageMetadataProviderTests.swift +++ b/Tests/PackageCollectionsTests/GitHubPackageMetadataProviderTests.swift @@ -49,7 +49,7 @@ class GitHubPackageMetadataProviderTests: XCTestCase { let apiURL = URL("https://api.github.com/repos/octocat/Hello-World") let releasesURL = URL("https://api.github.com/repos/octocat/Hello-World/releases?per_page=20") - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let handler: LegacyHTTPClient.Handler = { request, _, completion in switch (request.method, request.url) { case (.get, apiURL): @@ -152,7 +152,7 @@ class GitHubPackageMetadataProviderTests: XCTestCase { let repoURL = SourceControlURL("https://github.com/octocat/Hello-World.git") let apiURL = URL("https://api.github.com/repos/octocat/Hello-World") - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "GitHub", "metadata.json") let data = try Data(localFileSystem.readFileContents(path).contents) let handler: LegacyHTTPClient.Handler = { request, _, completion in @@ -246,7 +246,7 @@ class GitHubPackageMetadataProviderTests: XCTestCase { let total = 5 var remaining = total - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "GitHub", "metadata.json") let data = try Data(localFileSystem.readFileContents(path).contents) let handler: LegacyHTTPClient.Handler = { request, _, completion in @@ -291,7 +291,7 @@ class GitHubPackageMetadataProviderTests: XCTestCase { func testInvalidURL() async throws { try await testWithTemporaryDirectory { tmpPath in - try await fixture(name: "Collections", createGitRepo: false) { _ in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { _ in var configuration = GitHubPackageMetadataProvider.Configuration() configuration.cacheDir = tmpPath let provider = GitHubPackageMetadataProvider(configuration: configuration) @@ -308,7 +308,7 @@ class GitHubPackageMetadataProviderTests: XCTestCase { func testInvalidURL2() async throws { try await testWithTemporaryDirectory { tmpPath in - try await fixture(name: "Collections", createGitRepo: false) { _ in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { _ in var configuration = GitHubPackageMetadataProvider.Configuration() configuration.cacheDir = tmpPath let provider = GitHubPackageMetadataProvider(configuration: configuration) diff --git a/Tests/PackageCollectionsTests/JSONPackageCollectionProviderTests.swift b/Tests/PackageCollectionsTests/JSONPackageCollectionProviderTests.swift index e0fb970a31e..7b3379d9add 100644 --- a/Tests/PackageCollectionsTests/JSONPackageCollectionProviderTests.swift +++ b/Tests/PackageCollectionsTests/JSONPackageCollectionProviderTests.swift @@ -22,7 +22,7 @@ import _InternalTestSupport class JSONPackageCollectionProviderTests: XCTestCase { func testGood() async throws { - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good.json") let url = URL("https://www.test.com/collection.json") let data: Data = try localFileSystem.readFileContents(path) @@ -88,7 +88,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { } func testLocalFile() async throws { - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good.json") let httpClient = LegacyHTTPClient(handler: { (_, _, _) -> Void in fatalError("should not be called") }) @@ -374,7 +374,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { func testSignedGood() async throws { try skipIfSignatureCheckNotSupported() - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good_signed.json") let url = URL("https://www.test.com/collection.json") let data: Data = try localFileSystem.readFileContents(path) @@ -447,7 +447,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { } func testSigned_skipSignatureCheck() async throws { - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good_signed.json") let url = URL("https://www.test.com/collection.json") let data: Data = try localFileSystem.readFileContents(path) @@ -518,7 +518,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { func testSigned_noTrustedRootCertsConfigured() async throws { try skipIfSignatureCheckNotSupported() - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good_signed.json") let url = URL("https://www.test.com/collection.json") let data: Data = try localFileSystem.readFileContents(path) @@ -560,7 +560,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { func testSignedBad() async throws { try skipIfSignatureCheckNotSupported() - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good_signed.json") let url = URL("https://www.test.com/collection.json") let data: Data = try localFileSystem.readFileContents(path) @@ -603,7 +603,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { func testSignedLocalFile() async throws { try skipIfSignatureCheckNotSupported() - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good_signed.json") let httpClient = LegacyHTTPClient(handler: { (_, _, _) -> Void in fatalError("should not be called") }) @@ -655,7 +655,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { } func testRequiredSigningGood() async throws { - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good_signed.json") let url = URL("https://www.test.com/collection.json") let data: Data = try localFileSystem.readFileContents(path) @@ -729,7 +729,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { } func testRequiredSigningMultiplePoliciesGood() async throws { - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good_signed.json") let url = URL("https://www.test.com/collection.json") let data: Data = try localFileSystem.readFileContents(path) @@ -808,7 +808,7 @@ class JSONPackageCollectionProviderTests: XCTestCase { } func testMissingRequiredSignature() async throws { - try await fixture(name: "Collections", createGitRepo: false) { fixturePath in + try await fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in let path = fixturePath.appending(components: "JSON", "good.json") let url = URL("https://www.test.com/collection.json") let data: Data = try localFileSystem.readFileContents(path) diff --git a/Tests/PackageCollectionsTests/PackageCollectionsModelTests.swift b/Tests/PackageCollectionsTests/PackageCollectionsModelTests.swift index 82d4177230e..76ef89629ba 100644 --- a/Tests/PackageCollectionsTests/PackageCollectionsModelTests.swift +++ b/Tests/PackageCollectionsTests/PackageCollectionsModelTests.swift @@ -90,7 +90,7 @@ final class PackageCollectionsModelTests: XCTestCase { } func testSourceValidation_localFile() throws { - try fixture(name: "Collections", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Collections", createGitRepo: false) { fixturePath in // File must exist in local FS let path = fixturePath.appending(components: "JSON", "good.json") diff --git a/Tests/PackageRegistryTests/SignatureValidationTests.swift b/Tests/PackageRegistryTests/SignatureValidationTests.swift index 5bf356f062c..0f31d33fb86 100644 --- a/Tests/PackageRegistryTests/SignatureValidationTests.swift +++ b/Tests/PackageRegistryTests/SignatureValidationTests.swift @@ -1774,7 +1774,7 @@ final class SignatureValidationTests: XCTestCase { } private func ecSelfSignedTestKeyAndCertChain() throws -> KeyAndCertChain { - try fixture(name: "Signing", createGitRepo: false) { fixturePath in + try fixtureXCTest(name: "Signing", createGitRepo: false) { fixturePath in let privateKey = try localFileSystem.readFileContents( fixturePath.appending(components: "Certificates", "Test_ec_self_signed_key.p8") ).contents diff --git a/Tests/SourceControlTests/RepositoryManagerTests.swift b/Tests/SourceControlTests/RepositoryManagerTests.swift index e8a94bbdc29..10b354b451f 100644 --- a/Tests/SourceControlTests/RepositoryManagerTests.swift +++ b/Tests/SourceControlTests/RepositoryManagerTests.swift @@ -126,7 +126,7 @@ final class RepositoryManagerTests: XCTestCase { let fs = localFileSystem let observability = ObservabilitySystem.makeForTesting() - try await fixture(name: "DependencyResolution/External/Simple") { (fixturePath: AbsolutePath) in + try await fixtureXCTest(name: "DependencyResolution/External/Simple") { (fixturePath: AbsolutePath) in let cachePath = fixturePath.appending("cache") let repositoriesPath = fixturePath.appending("repositories") let repo = RepositorySpecifier(path: fixturePath.appending("Foo")) diff --git a/Tests/WorkspaceTests/PrebuiltsTests.swift b/Tests/WorkspaceTests/PrebuiltsTests.swift index 8725d6c2d66..759e94c3721 100644 --- a/Tests/WorkspaceTests/PrebuiltsTests.swift +++ b/Tests/WorkspaceTests/PrebuiltsTests.swift @@ -34,7 +34,7 @@ final class PrebuiltsTests: XCTestCase { swiftSyntaxURL: String? = nil, run: (Workspace.SignedPrebuiltsManifest, AbsolutePath, MockPackage, MockPackage) async throws -> () ) async throws { - try await fixture(name: "Signing") { fixturePath in + try await fixtureXCTest(name: "Signing") { fixturePath in let swiftSyntaxURL = swiftSyntaxURL ?? "https://github.com/swiftlang/swift-syntax" let manifest = Workspace.PrebuiltsManifest(libraries: [ diff --git a/Tests/_InternalTestSupportTests/Misc.swift b/Tests/_InternalTestSupportTests/MiscTests.swift similarity index 100% rename from Tests/_InternalTestSupportTests/Misc.swift rename to Tests/_InternalTestSupportTests/MiscTests.swift