1
1
/*
2
2
This source file is part of the Swift.org open source project
3
3
4
- Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
4
+ Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
6
7
7
See http://swift.org/LICENSE.txt for license information
@@ -142,7 +142,7 @@ final class BuildPlanTests: XCTestCase {
142
142
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
143
143
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
144
144
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
145
- " -target " , " x86_64-apple-macosx10.10 " , " -Xlinker " , " -add_ast_path " ,
145
+ " -target " , defaultTargetTriple , " -Xlinker " , " -add_ast_path " ,
146
146
" -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " , " -Xlinker " , " -add_ast_path " ,
147
147
" -Xlinker " , " /path/to/build/debug/lib.swiftmodule " ,
148
148
]
@@ -169,6 +169,11 @@ final class BuildPlanTests: XCTestCase {
169
169
}
170
170
171
171
func testExplicitSwiftPackageBuild( ) throws {
172
+ #if os(macOS) && arch(arm64)
173
+ // Disabled on Apple Silicon on the 5.4 branch
174
+ // because relies on fixes from later compiler versions.
175
+ throw XCTSkip ( )
176
+ #endif
172
177
try withTemporaryDirectory { path in
173
178
// Create a test package with three targets:
174
179
// A -> B -> C
@@ -454,7 +459,7 @@ final class BuildPlanTests: XCTestCase {
454
459
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
455
460
" @/path/to/build/release/exe.product/Objects.LinkFileList " ,
456
461
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
457
- " -target " , " x86_64-apple-macosx10.10 " ,
462
+ " -target " , defaultTargetTriple ,
458
463
] )
459
464
#else
460
465
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -556,7 +561,7 @@ final class BuildPlanTests: XCTestCase {
556
561
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
557
562
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
558
563
" -runtime-compatibility-version " , " none " ,
559
- " -target " , " x86_64-apple-macosx10.10 " ,
564
+ " -target " , defaultTargetTriple ,
560
565
] )
561
566
#else
562
567
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -707,7 +712,7 @@ final class BuildPlanTests: XCTestCase {
707
712
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
708
713
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
709
714
" -runtime-compatibility-version " , " none " ,
710
- " -target " , " x86_64-apple-macosx10.10 " ,
715
+ " -target " , defaultTargetTriple ,
711
716
] )
712
717
#else
713
718
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -783,7 +788,7 @@ final class BuildPlanTests: XCTestCase {
783
788
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
784
789
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
785
790
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
786
- " -target " , " x86_64-apple-macosx10.10 " ,
791
+ " -target " , defaultTargetTriple ,
787
792
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " ,
788
793
] )
789
794
#else
@@ -936,7 +941,7 @@ final class BuildPlanTests: XCTestCase {
936
941
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path/../../../ " ,
937
942
" @/path/to/build/debug/PkgPackageTests.product/Objects.LinkFileList " ,
938
943
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
939
- " -target " , " x86_64-apple-macosx \( version) " ,
944
+ " -target " , " \( hostTriple . tripleString ( forPlatformVersion : version) ) " ,
940
945
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Foo.swiftmodule " ,
941
946
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/FooTests.swiftmodule " ,
942
947
] )
@@ -993,7 +998,7 @@ final class BuildPlanTests: XCTestCase {
993
998
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
994
999
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
995
1000
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
996
- " -target " , " x86_64-apple-macosx10.10 " ,
1001
+ " -target " , defaultTargetTriple ,
997
1002
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " ,
998
1003
] )
999
1004
#else
@@ -1091,7 +1096,7 @@ final class BuildPlanTests: XCTestCase {
1091
1096
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1092
1097
" @/path/to/build/debug/Foo.product/Objects.LinkFileList " ,
1093
1098
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
1094
- " -target " , " x86_64-apple-macosx10.10 " ,
1099
+ " -target " , defaultTargetTriple ,
1095
1100
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Foo.build/Foo.swiftmodule "
1096
1101
] )
1097
1102
@@ -1102,7 +1107,7 @@ final class BuildPlanTests: XCTestCase {
1102
1107
" -Xlinker " , " -install_name " , " -Xlinker " , " @rpath/libBar-Baz.dylib " ,
1103
1108
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1104
1109
" @/path/to/build/debug/Bar-Baz.product/Objects.LinkFileList " ,
1105
- " -target " , " x86_64-apple-macosx10.10 " ,
1110
+ " -target " , defaultTargetTriple ,
1106
1111
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Bar.swiftmodule "
1107
1112
] )
1108
1113
#else
@@ -1182,7 +1187,7 @@ final class BuildPlanTests: XCTestCase {
1182
1187
" -Xlinker " , " -install_name " , " -Xlinker " , " @rpath/liblib.dylib " ,
1183
1188
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1184
1189
" @/path/to/build/debug/lib.product/Objects.LinkFileList " ,
1185
- " -target " , " x86_64-apple-macosx10.10 " ,
1190
+ " -target " , defaultTargetTriple ,
1186
1191
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/lib.swiftmodule " ,
1187
1192
]
1188
1193
#else
@@ -1252,9 +1257,9 @@ final class BuildPlanTests: XCTestCase {
1252
1257
XCTAssertEqual ( lib. moduleMap, AbsolutePath ( " /path/to/build/debug/lib.build/module.modulemap " ) )
1253
1258
1254
1259
#if os(macOS)
1255
- XCTAssertEqual ( try result. buildProduct ( for: " lib " ) . linkArguments ( ) , [ " /fake/path/to/swiftc " , " -lc++ " , " -L " , " /path/to/build/debug " , " -o " , " /path/to/build/debug/liblib.dylib " , " -module-name " , " lib " , " -emit-library " , " -Xlinker " , " -install_name " , " -Xlinker " , " @rpath/liblib.dylib " , " -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " , " @/path/to/build/debug/lib.product/Objects.LinkFileList " , " -runtime-compatibility-version " , " none " , " -target " , " x86_64-apple-macosx10.10 " ] )
1260
+ XCTAssertEqual ( try result. buildProduct ( for: " lib " ) . linkArguments ( ) , [ " /fake/path/to/swiftc " , " -lc++ " , " -L " , " /path/to/build/debug " , " -o " , " /path/to/build/debug/liblib.dylib " , " -module-name " , " lib " , " -emit-library " , " -Xlinker " , " -install_name " , " -Xlinker " , " @rpath/liblib.dylib " , " -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " , " @/path/to/build/debug/lib.product/Objects.LinkFileList " , " -runtime-compatibility-version " , " none " , " -target " , defaultTargetTriple ] )
1256
1261
1257
- XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [ " /fake/path/to/swiftc " , " -L " , " /path/to/build/debug " , " -o " , " /path/to/build/debug/exe " , " -module-name " , " exe " , " -emit-executable " , " -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " , " @/path/to/build/debug/exe.product/Objects.LinkFileList " , " -runtime-compatibility-version " , " none " , " -target " , " x86_64-apple-macosx10.10 " ] )
1262
+ XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [ " /fake/path/to/swiftc " , " -L " , " /path/to/build/debug " , " -o " , " /path/to/build/debug/exe " , " -module-name " , " exe " , " -emit-executable " , " -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " , " @/path/to/build/debug/exe.product/Objects.LinkFileList " , " -runtime-compatibility-version " , " none " , " -target " , defaultTargetTriple ] )
1258
1263
#else
1259
1264
XCTAssertEqual ( try result. buildProduct ( for: " lib " ) . linkArguments ( ) , [ " /fake/path/to/swiftc " , " -lstdc++ " , " -L " , " /path/to/build/debug " , " -o " , " /path/to/build/debug/liblib.so " , " -module-name " , " lib " , " -emit-library " , " -Xlinker " , " -rpath=$ORIGIN " , " @/path/to/build/debug/lib.product/Objects.LinkFileList " , " -runtime-compatibility-version " , " none " , " -target " , defaultTargetTriple] )
1260
1265
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [ " /fake/path/to/swiftc " , " -L " , " /path/to/build/debug " , " -o " , " /path/to/build/debug/exe " , " -module-name " , " exe " , " -emit-executable " , " -Xlinker " , " -rpath=$ORIGIN " , " @/path/to/build/debug/exe.product/Objects.LinkFileList " , " -runtime-compatibility-version " , " none " , " -target " , defaultTargetTriple] )
@@ -1811,14 +1816,14 @@ final class BuildPlanTests: XCTestCase {
1811
1816
1812
1817
let aTarget = try result. target ( for: " ATarget " ) . swiftTarget ( ) . compileArguments ( )
1813
1818
#if os(macOS)
1814
- XCTAssertMatch ( aTarget, [ " -target " , " x86_64-apple-macosx10 .13" , . anySequence] )
1819
+ XCTAssertMatch ( aTarget, [ . equal ( " -target " ) , . equal ( hostTriple . tripleString ( forPlatformVersion : " 10 .13" ) ) , . anySequence] )
1815
1820
#else
1816
1821
XCTAssertMatch ( aTarget, [ . equal( " -target " ) , . equal( defaultTargetTriple) , . anySequence] )
1817
1822
#endif
1818
1823
1819
1824
let bTarget = try result. target ( for: " BTarget " ) . swiftTarget ( ) . compileArguments ( )
1820
1825
#if os(macOS)
1821
- XCTAssertMatch ( bTarget, [ " -target " , " x86_64-apple-macosx10 .12" , . anySequence] )
1826
+ XCTAssertMatch ( bTarget, [ . equal ( " -target " ) , . equal ( hostTriple . tripleString ( forPlatformVersion : " 10 .12" ) ) , . anySequence] )
1822
1827
#else
1823
1828
XCTAssertMatch ( bTarget, [ . equal( " -target " ) , . equal( defaultTargetTriple) , . anySequence] )
1824
1829
#endif
0 commit comments