@@ -754,12 +754,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
754
754
// We only care about prebuilt modules in macOS.
755
755
#if os(macOS)
756
756
func testPrebuiltModuleGenerationJobs( ) throws {
757
- #if arch(arm64)
758
- // Disabled on Apple Silicon
759
- // rdar://76609781
760
- throw XCTSkip ( )
761
- #endif
762
-
763
757
func getInputModules( _ job: Job ) -> [ String ] {
764
758
return job. inputs. map { input in
765
759
return input. file. absolutePath!. parentDirectory. basenameWithoutExt
@@ -791,7 +785,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
791
785
job. outputs [ 0 ] . file. basenameWithoutExt == basenameWithoutExt
792
786
}
793
787
}
794
-
795
788
let packageRootPath = URL ( fileURLWithPath: #file) . pathComponents
796
789
. prefix ( while: { $0 != " Tests " } ) . joined ( separator: " / " ) . dropFirst ( )
797
790
let testInputsPath = packageRootPath + " /TestInputs "
@@ -801,12 +794,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
801
794
let interfaceMap = try collector. collectSwiftInterfaceMap ( )
802
795
803
796
// Check interface map always contain everything
804
- XCTAssertTrue ( interfaceMap [ " Swift " ] !. count == 2 )
805
- XCTAssertTrue ( interfaceMap [ " A " ] !. count == 2 )
806
- XCTAssertTrue ( interfaceMap [ " E " ] !. count == 2 )
797
+ XCTAssertTrue ( interfaceMap [ " Swift " ] !. count == 3 )
798
+ XCTAssertTrue ( interfaceMap [ " A " ] !. count == 3 )
799
+ XCTAssertTrue ( interfaceMap [ " E " ] !. count == 3 )
807
800
XCTAssertTrue ( interfaceMap [ " F " ] !. count == 3 )
808
- XCTAssertTrue ( interfaceMap [ " G " ] !. count == 2 )
809
- XCTAssertTrue ( interfaceMap [ " H " ] !. count == 2 )
801
+ XCTAssertTrue ( interfaceMap [ " G " ] !. count == 3 )
802
+ XCTAssertTrue ( interfaceMap [ " H " ] !. count == 3 )
810
803
811
804
try withTemporaryDirectory { path in
812
805
let main = path. appending ( component: " testPrebuiltModuleGenerationJobs.swift " )
@@ -821,7 +814,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
821
814
var driver = try Driver ( args: [ " swiftc " , main. pathString,
822
815
" -sdk " , mockSDKPath,
823
816
] )
824
-
825
817
let ( jobs, danglingJobs) = try driver. generatePrebuitModuleGenerationJobs ( with: interfaceMap,
826
818
into: VirtualPath ( path: " /tmp/ " ) . absolutePath!,
827
819
exhaustive: true )
@@ -830,22 +822,30 @@ final class ExplicitModuleBuildTests: XCTestCase {
830
822
XCTAssertTrue ( danglingJobs. allSatisfy { job in
831
823
job. moduleName == " MissingKit "
832
824
} )
833
- XCTAssertTrue ( jobs. count == 13 )
825
+ XCTAssertTrue ( jobs. count == 18 )
834
826
XCTAssertTrue ( jobs. allSatisfy { $0. outputs. count == 1 } )
835
827
XCTAssertTrue ( jobs. allSatisfy { $0. kind == . compile} )
836
828
XCTAssertTrue ( jobs. allSatisfy { $0. commandLine. contains ( . flag( " -compile-module-from-interface " ) ) } )
837
829
let HJobs = jobs. filter { $0. moduleName == " H " }
838
- XCTAssertTrue ( HJobs . count == 2 )
839
- XCTAssertTrue ( getInputModules ( HJobs [ 0 ] ) == [ " A " , " E " , " F " , " G " , " Swift " ] )
830
+ XCTAssertTrue ( HJobs . count == 3 )
831
+ // arm64
832
+ XCTAssertTrue ( getInputModules ( HJobs [ 0 ] ) == [ " A " , " A " , " E " , " E " , " F " , " F " , " G " , " G " , " Swift " , " Swift " ] )
833
+ // arm64e
840
834
XCTAssertTrue ( getInputModules ( HJobs [ 1 ] ) == [ " A " , " E " , " F " , " G " , " Swift " ] )
835
+ // x86_64
836
+ XCTAssertTrue ( getInputModules ( HJobs [ 2 ] ) == [ " A " , " E " , " F " , " G " , " Swift " ] )
841
837
XCTAssertTrue ( getOutputName ( HJobs [ 0 ] ) != getOutputName ( HJobs [ 1 ] ) )
838
+ XCTAssertTrue ( getOutputName ( HJobs [ 1 ] ) != getOutputName ( HJobs [ 2 ] ) )
842
839
checkInputOutputIntegrity ( HJobs [ 0 ] )
843
840
checkInputOutputIntegrity ( HJobs [ 1 ] )
841
+ checkInputOutputIntegrity ( HJobs [ 2 ] )
844
842
let GJobs = jobs. filter { $0. moduleName == " G " }
845
- XCTAssertTrue ( GJobs . count == 2 )
846
- XCTAssertTrue ( getInputModules ( GJobs [ 0 ] ) == [ " E " , " Swift " ] )
843
+ XCTAssertTrue ( GJobs . count == 3 )
844
+ XCTAssertTrue ( getInputModules ( GJobs [ 0 ] ) == [ " E " , " E " , " Swift " , " Swift " ] )
847
845
XCTAssertTrue ( getInputModules ( GJobs [ 1 ] ) == [ " E " , " Swift " ] )
846
+ XCTAssertTrue ( getInputModules ( GJobs [ 2 ] ) == [ " E " , " Swift " ] )
848
847
XCTAssertTrue ( getOutputName ( GJobs [ 0 ] ) != getOutputName ( GJobs [ 1 ] ) )
848
+ XCTAssertTrue ( getOutputName ( GJobs [ 1 ] ) != getOutputName ( GJobs [ 2 ] ) )
849
849
checkInputOutputIntegrity ( GJobs [ 0 ] )
850
850
checkInputOutputIntegrity ( GJobs [ 1 ] )
851
851
}
@@ -857,28 +857,33 @@ final class ExplicitModuleBuildTests: XCTestCase {
857
857
var driver = try Driver ( args: [ " swiftc " , main. pathString,
858
858
" -sdk " , mockSDKPath,
859
859
] )
860
-
861
860
let ( jobs, danglingJobs) = try driver. generatePrebuitModuleGenerationJobs ( with: interfaceMap,
862
861
into: VirtualPath ( path: " /tmp/ " ) . absolutePath!,
863
862
exhaustive: false )
864
863
865
864
XCTAssertTrue ( danglingJobs. isEmpty)
866
- XCTAssertTrue ( jobs. count == 13 )
865
+ XCTAssertTrue ( jobs. count == 18 )
867
866
XCTAssertTrue ( jobs. allSatisfy { $0. outputs. count == 1 } )
868
867
XCTAssertTrue ( jobs. allSatisfy { $0. kind == . compile} )
869
868
XCTAssertTrue ( jobs. allSatisfy { $0. commandLine. contains ( . flag( " -compile-module-from-interface " ) ) } )
870
869
let HJobs = jobs. filter { $0. moduleName == " H " }
871
- XCTAssertTrue ( HJobs . count == 2 )
872
- XCTAssertTrue ( getInputModules ( HJobs [ 0 ] ) == [ " A " , " E " , " F " , " G " , " Swift " ] )
870
+ XCTAssertTrue ( HJobs . count == 3 )
871
+ // arm64
872
+ XCTAssertTrue ( getInputModules ( HJobs [ 0 ] ) == [ " A " , " A " , " E " , " E " , " F " , " F " , " G " , " G " , " Swift " , " Swift " ] )
873
+ // arm64e
873
874
XCTAssertTrue ( getInputModules ( HJobs [ 1 ] ) == [ " A " , " E " , " F " , " G " , " Swift " ] )
875
+ // x86_64
876
+ XCTAssertTrue ( getInputModules ( HJobs [ 2 ] ) == [ " A " , " E " , " F " , " G " , " Swift " ] )
874
877
XCTAssertTrue ( getOutputName ( HJobs [ 0 ] ) != getOutputName ( HJobs [ 1 ] ) )
875
878
checkInputOutputIntegrity ( HJobs [ 0 ] )
876
879
checkInputOutputIntegrity ( HJobs [ 1 ] )
877
880
let GJobs = jobs. filter { $0. moduleName == " G " }
878
- XCTAssertTrue ( GJobs . count == 2 )
879
- XCTAssertTrue ( getInputModules ( GJobs [ 0 ] ) == [ " E " , " Swift " ] )
881
+ XCTAssertTrue ( GJobs . count == 3 )
882
+ XCTAssertTrue ( getInputModules ( GJobs [ 0 ] ) == [ " E " , " E " , " Swift " , " Swift " ] )
880
883
XCTAssertTrue ( getInputModules ( GJobs [ 1 ] ) == [ " E " , " Swift " ] )
884
+ XCTAssertTrue ( getInputModules ( GJobs [ 2 ] ) == [ " E " , " Swift " ] )
881
885
XCTAssertTrue ( getOutputName ( GJobs [ 0 ] ) != getOutputName ( GJobs [ 1 ] ) )
886
+ XCTAssertTrue ( getOutputName ( GJobs [ 1 ] ) != getOutputName ( GJobs [ 2 ] ) )
882
887
checkInputOutputIntegrity ( GJobs [ 0 ] )
883
888
checkInputOutputIntegrity ( GJobs [ 1 ] )
884
889
}
@@ -890,13 +895,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
890
895
var driver = try Driver ( args: [ " swiftc " , main. pathString,
891
896
" -sdk " , mockSDKPath,
892
897
] )
893
-
894
898
let ( jobs, danglingJobs) = try driver. generatePrebuitModuleGenerationJobs ( with: interfaceMap,
895
899
into: VirtualPath ( path: " /tmp/ " ) . absolutePath!,
896
900
exhaustive: false )
897
901
898
902
XCTAssertTrue ( danglingJobs. isEmpty)
899
- XCTAssert ( jobs. count == 2 )
903
+ XCTAssert ( jobs. count == 3 )
900
904
XCTAssert ( jobs. allSatisfy { $0. moduleName == " Swift " } )
901
905
}
902
906
try withTemporaryDirectory { path in
@@ -907,13 +911,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
907
911
var driver = try Driver ( args: [ " swiftc " , main. pathString,
908
912
" -sdk " , mockSDKPath,
909
913
] )
910
-
911
914
let ( jobs, danglingJobs) = try driver. generatePrebuitModuleGenerationJobs ( with: interfaceMap,
912
915
into: VirtualPath ( path: " /tmp/ " ) . absolutePath!,
913
916
exhaustive: false )
914
917
915
918
XCTAssertTrue ( danglingJobs. isEmpty)
916
- XCTAssertTrue ( jobs. count == 7 )
919
+ XCTAssertTrue ( jobs. count == 9 )
917
920
jobs. forEach ( { job in
918
921
// Check we don't pull in other modules than A, F and Swift
919
922
XCTAssertTrue ( [ " A " , " F " , " Swift " ] . contains ( job. moduleName) )
@@ -928,7 +931,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
928
931
var driver = try Driver ( args: [ " swiftc " , main. pathString,
929
932
" -sdk " , mockSDKPath,
930
933
] )
931
-
932
934
let ( jobs, _) = try driver. generatePrebuitModuleGenerationJobs ( with: interfaceMap,
933
935
into: VirtualPath ( path: " /tmp/ " ) . absolutePath!,
934
936
exhaustive: false )
0 commit comments