From 5131fb8c2d8610ae603f40a89507582d762dbd2d Mon Sep 17 00:00:00 2001 From: Artem Chikin Date: Thu, 12 Oct 2023 06:20:01 -0700 Subject: [PATCH] [ExplicitModuleBuilds][Tests] Remove test of prior approach at handling dependency PCH As of https://github.com/apple/swift/pull/69109 we no longer propagate the PCH to dependencies in non-cached builds. For cached builds, this functionality is tested in 'testCacheBuildEndToEndWithBinaryHeaderDeps'. --- .../ExplicitModuleBuildTests.swift | 76 ------------------- 1 file changed, 76 deletions(-) diff --git a/Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift b/Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift index c5b306221..bd466d996 100644 --- a/Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift +++ b/Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift @@ -1014,82 +1014,6 @@ final class ExplicitModuleBuildTests: XCTestCase { } } - func testExplicitModuleBuildEndToEndWithBinaryHeaderDeps() throws { - try withTemporaryDirectory { path in - try localFileSystem.changeCurrentWorkingDirectory(to: path) - let moduleCachePath = path.appending(component: "ModuleCache") - try localFileSystem.createDirectory(moduleCachePath) - let PCHPath = path.appending(component: "PCH") - try localFileSystem.createDirectory(PCHPath) - let FooInstallPath = path.appending(component: "Foo") - try localFileSystem.createDirectory(FooInstallPath) - let foo = path.appending(component: "foo.swift") - try localFileSystem.writeFileContents(foo) { - $0 <<< "extension Profiler {" - $0 <<< " public static let count: Int = 42" - $0 <<< "}" - } - let fooHeader = path.appending(component: "foo.h") - try localFileSystem.writeFileContents(fooHeader) { - $0 <<< "struct Profiler { void* ptr; };" - } - let main = path.appending(component: "main.swift") - try localFileSystem.writeFileContents(main) { - $0 <<< "import Foo" - } - let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? [] - - var fooBuildDriver = try Driver(args: ["swiftc", - "-explicit-module-build", - "-module-cache-path", moduleCachePath.nativePathString(escaped: true), - "-working-directory", path.nativePathString(escaped: true), - foo.nativePathString(escaped: true), - "-emit-module", "-wmo", "-module-name", "Foo", - "-emit-module-path", FooInstallPath.nativePathString(escaped: true), - "-import-objc-header", fooHeader.nativePathString(escaped: true), - "-pch-output-dir", PCHPath.nativePathString(escaped: true), - FooInstallPath.appending(component: "Foo.swiftmodule").nativePathString(escaped: true)] - + sdkArgumentsForTesting, - env: ProcessEnv.vars) - - // Ensure this tooling supports this functionality - let dependencyOracle = InterModuleDependencyOracle() - let scanLibPath = try XCTUnwrap(fooBuildDriver.toolchain.lookupSwiftScanLib()) - guard try dependencyOracle - .verifyOrCreateScannerInstance(fileSystem: localFileSystem, - swiftScanLibPath: scanLibPath) else { - XCTFail("Dependency scanner library not found") - return - } - guard try dependencyOracle.supportsBinaryModuleHeaderDependencies() else { - throw XCTSkip("libSwiftScan does not support binary module header dependencies.") - } - - let fooJobs = try fooBuildDriver.planBuild() - try fooBuildDriver.run(jobs: fooJobs) - XCTAssertFalse(fooBuildDriver.diagnosticEngine.hasErrors) - - var driver = try Driver(args: ["swiftc", - "-I", FooInstallPath.nativePathString(escaped: true), - "-explicit-module-build", "-emit-module", "-emit-module-path", - path.appending(component: "testEMBETEWBHD.swiftmodule").nativePathString(escaped: true), - "-module-cache-path", moduleCachePath.nativePathString(escaped: true), - "-working-directory", path.nativePathString(escaped: true), - main.nativePathString(escaped: true)] + sdkArgumentsForTesting, - env: ProcessEnv.vars) - let jobs = try driver.planBuild() - let compileJob = try XCTUnwrap(jobs.first(where: { $0.description == "Compiling main main.swift" })) - - // Ensure the header dependency of Foo shows up on client compile commands - XCTAssertTrue(compileJob.commandLine.contains(subsequence: [.flag("-Xcc"), - .flag("-include-pch"), - .flag("-Xcc"), - .path(.absolute(PCHPath.appending(component: "foo.pch")))])) - try driver.run(jobs: jobs) - XCTAssertFalse(driver.diagnosticEngine.hasErrors) - } - } - func testExplicitModuleBuildEndToEnd() throws { try withTemporaryDirectory { path in try localFileSystem.changeCurrentWorkingDirectory(to: path)