@@ -716,10 +716,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
716716 for job in jobs {
717717 XCTAssertEqual ( job. outputs. count, 1 )
718718 let outputFilePath = job. outputs [ 0 ] . file
719- if job. kind == . compile && driver. isFrontendArgSupported ( . debugModulePath) {
720- XCTAssertTrue ( job. commandLine. contains ( subsequence: [ " -debug-module-path " , try toPathOption ( " testExplicitModuleBuildJobs.swiftmodule " ) ] ) )
721-
722- }
723719
724720 // Swift dependencies
725721 if let outputFileExtension = outputFilePath. extension,
@@ -782,6 +778,38 @@ final class ExplicitModuleBuildTests: XCTestCase {
782778 }
783779 }
784780
781+ /// Test the -debug-module-path option in expilicit builds.
782+ func testExplicitModuleBuildDebugModulePath( ) throws {
783+ let ( stdlibPath, shimsPath, _, _) = try getDriverArtifactsForScanning ( )
784+ try withTemporaryDirectory { path in
785+ let main = path. appending ( component: " testExplicitModuleBuildJobs.swift " )
786+ try localFileSystem. writeFileContents ( main, bytes:
787+ """
788+ import C;
789+ """
790+ )
791+
792+ let swiftModuleInterfacesPath : AbsolutePath =
793+ try testInputsPath. appending ( component: " ExplicitModuleBuilds " )
794+ . appending ( component: " Swift " )
795+ let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
796+ var driver = try Driver ( args: [ " swiftc " ,
797+ " -g " ,
798+ " -I " , swiftModuleInterfacesPath. nativePathString ( escaped: false ) ,
799+ " -I " , stdlibPath. nativePathString ( escaped: false ) ,
800+ " -I " , shimsPath. nativePathString ( escaped: false ) ,
801+ " -explicit-module-build " ,
802+ " -disable-implicit-concurrency-module-import " ,
803+ " -disable-implicit-string-processing-module-import " ,
804+ main. nativePathString ( escaped: false ) ] + sdkArgumentsForTesting)
805+ guard driver. isFrontendArgSupported ( . debugModulePath) else { return }
806+ let jobs = try driver. planBuild ( )
807+ try jobs. filter { $0. kind == . compile } . forEach { job in
808+ XCTAssertTrue ( job. commandLine. contains ( subsequence: [ " -debug-module-path " , try toPathOption ( " testExplicitModuleBuildJobs.swiftmodule " ) ] ) )
809+ }
810+ }
811+ }
812+
785813 func testRegisterModuleDependencyFlag( ) throws {
786814 let ( stdlibPath, shimsPath, _, _) = try getDriverArtifactsForScanning ( )
787815 try withTemporaryDirectory { path in
@@ -1100,24 +1128,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
11001128 let baseName = " testExplicitModuleVerifyInterfaceJobs "
11011129 XCTAssertTrue ( matchTemporary ( outputFilePath, basename: baseName, fileExtension: " o " ) ||
11021130 matchTemporary ( outputFilePath, basename: baseName, fileExtension: " autolink " ) )
1103- if outputFilePath. extension == FileType . object. rawValue && driver. isFrontendArgSupported ( . debugModulePath) {
1104- // Check that this is an absolute path pointing to the temporary directory.
1105- var found : Bool = false
1106- for arg in job. commandLine {
1107- if !found && arg == " -debug-module-path " {
1108- found = true
1109- } else if found {
1110- if case let . path( vpath) = arg {
1111- XCTAssertTrue ( vpath. isTemporary)
1112- XCTAssertTrue ( vpath. extension == FileType . swiftModule. rawValue)
1113- } else {
1114- XCTFail ( " argument is not a path " )
1115- }
1116- break
1117- }
1118- }
1119- XCTAssertTrue ( found)
1120- }
11211131 default :
11221132 XCTFail ( " Unexpected module dependency build job output: \( outputFilePath) " )
11231133 }
0 commit comments