@@ -3536,7 +3536,7 @@ final class BuildPlanTests: XCTestCase {
3536
3536
toolset: . init(
3537
3537
knownTools: [
3538
3538
. cCompiler: . init( extraCLIOptions: [ " -I/fake/sdk/sysroot " , " -clang-flag-from-json " ] ) ,
3539
- . swiftCompiler: . init( extraCLIOptions: [ " -swift-flag-from-json " ] )
3539
+ . swiftCompiler: . init( extraCLIOptions: [ " -swift-flag-from-json " , " -use-ld=lld " ] ) ,
3540
3540
] ,
3541
3541
rootPaths: try UserToolchain . default. destination. toolset. rootPaths
3542
3542
) ,
@@ -3567,7 +3567,18 @@ final class BuildPlanTests: XCTestCase {
3567
3567
XCTAssertMatch ( try lib. basicArguments ( isCXX: false ) , args)
3568
3568
3569
3569
let exe = try result. target ( for: " exe " ) . swiftTarget ( ) . compileArguments ( )
3570
- XCTAssertMatch ( exe, [ " -module-cache-path " , " \( buildPath. appending ( components: " ModuleCache " ) ) " , . anySequence, " -swift-flag-from-json " , " -g " , " -swift-command-line-flag " , . anySequence, " -Xcc " , " -clang-flag-from-json " , " -Xcc " , " -g " , " -Xcc " , " -clang-command-line-flag " ] )
3570
+ XCTAssertMatch ( exe, [
3571
+ " -module-cache-path " ,
3572
+ " \( buildPath. appending ( components: " ModuleCache " ) ) " ,
3573
+ . anySequence,
3574
+ " -swift-flag-from-json " ,
3575
+ . anySequence,
3576
+ " -swift-command-line-flag " ,
3577
+ . anySequence,
3578
+ " -Xcc " , " -clang-flag-from-json " ,
3579
+ . anySequence,
3580
+ " -Xcc " , " -clang-command-line-flag "
3581
+ ] )
3571
3582
}
3572
3583
3573
3584
func testUserToolchainWithToolsetCompileFlags( ) throws {
@@ -3757,7 +3768,10 @@ final class BuildPlanTests: XCTestCase {
3757
3768
properties: . init(
3758
3769
sdkRootPath: " /fake/sdk " ,
3759
3770
includeSearchPaths: [ sdkIncludeSearchPath] ,
3760
- librarySearchPaths: [ sdkLibrarySearchPath] ) )
3771
+ librarySearchPaths: [ sdkLibrarySearchPath] ) ,
3772
+ toolset: . init( knownTools: [
3773
+ . swiftCompiler: . init( extraCLIOptions: [ " -use-ld=lld " ] ) ,
3774
+ ] ) )
3761
3775
let toolchain = try UserToolchain ( destination: destination)
3762
3776
let buildParameters = mockBuildParameters ( toolchain: toolchain)
3763
3777
let result = try BuildPlanResult ( plan: BuildPlan (
@@ -3770,17 +3784,17 @@ final class BuildPlanTests: XCTestCase {
3770
3784
3771
3785
// Compile C Target
3772
3786
let cLibCompileArguments = try result. target ( for: " cLib " ) . clangTarget ( ) . basicArguments ( isCXX: false )
3773
- let cLibCompileArgumentsPattern : [ StringPattern ] = [ " -I " , " \( sdkIncludeSearchPath) " ]
3787
+ let cLibCompileArgumentsPattern : [ StringPattern ] = [ " -I " , " \( AbsolutePath ( sdkIncludeSearchPath) . _nativePathString ( escaped : false ) ) " ]
3774
3788
XCTAssertMatch ( cLibCompileArguments, cLibCompileArgumentsPattern)
3775
3789
3776
3790
// Compile Swift Target
3777
3791
let exeCompileArguments = try result. target ( for: " exe " ) . swiftTarget ( ) . compileArguments ( )
3778
- let exeCompileArgumentsPattern : [ StringPattern ] = [ " -I " , " \( sdkIncludeSearchPath) " ]
3792
+ let exeCompileArgumentsPattern : [ StringPattern ] = [ " -I " , " \( AbsolutePath ( sdkIncludeSearchPath) . _nativePathString ( escaped : false ) ) " ]
3779
3793
XCTAssertMatch ( exeCompileArguments, exeCompileArgumentsPattern)
3780
3794
3781
3795
// Link Product
3782
3796
let exeLinkArguments = try result. buildProduct ( for: " exe " ) . linkArguments ( )
3783
- let exeLinkArgumentsPattern : [ StringPattern ] = [ " -L " , " \( sdkIncludeSearchPath) " ]
3797
+ let exeLinkArgumentsPattern : [ StringPattern ] = [ " -L " , " \( AbsolutePath ( sdkIncludeSearchPath) . _nativePathString ( escaped : false ) ) " ]
3784
3798
XCTAssertMatch ( exeLinkArguments, exeLinkArgumentsPattern)
3785
3799
}
3786
3800
@@ -4750,7 +4764,7 @@ final class BuildPlanTests: XCTestCase {
4750
4764
4751
4765
let yamlContents : String = try fs. readFileContents ( yaml)
4752
4766
XCTAssertMatch ( yamlContents, . contains( """
4753
- inputs: [ " /Pkg/Snippets/ASnippet.swift " , " /Pkg/.build/debug/Lib.swiftmodule "
4767
+ inputs: [ " \( AbsolutePath ( " /Pkg/Snippets/ASnippet.swift " ) . _nativePathString ( escaped : true ) ) " , " \( AbsolutePath ( " /Pkg/.build/debug/Lib.swiftmodule " ) . _nativePathString ( escaped : true ) ) "
4754
4768
""" ) )
4755
4769
4756
4770
}
0 commit comments