@@ -45,7 +45,7 @@ def should_extract(l):
4545 if action == "build" :
4646 return any ([s in l for s in ["error:" ]])
4747 elif action == "test" :
48- return any ([s in l for s in ["failed:" , "launchd" ]])
48+ return any ([s in l for s in ["failed:" , "launchd" , "crash" ]])
4949
5050 def processRunResult (runResult ):
5151 end = time .time ()
@@ -78,22 +78,52 @@ def processRunResult(runResult):
7878
7979def prepare_to_build_tests ():
8080 print ("Preparing to build tests..." )
81+ run (["swift" , "package" , "--package-path" , "ReconfigurePbxprojPackageDependency" , "clean" ],
82+ cwd = Environment .Path .swiftusd_tests )
8183 run (["swift" , "run" , "--package-path" , "ReconfigurePbxprojPackageDependency" ,
8284 "ReconfigurePbxprojPackageDependency" , "SwiftUsdTests.xcodeproj/project.pbxproj" ,
8385 "--replace" , "https://github.com/apple/SwiftUsd" , "--with" , "SwiftUsd" ],
8486 cwd = Environment .Path .swiftusd_tests )
85- if not (Environment .Path .swiftusd_tests / "SwiftUsd" ).exists ():
86- (Environment .Path .swiftusd_tests / "SwiftUsd" ).symlink_to (Environment .Path .swiftusd )
87+
88+ if (Environment .Path .swiftusd_tests / "SwiftUsd" ).exists ():
89+ os .unlink (Environment .Path .swiftusd_tests / "SwiftUsd" )
90+ (Environment .Path .swiftusd_tests / "SwiftUsd" ).symlink_to (Environment .Path .swiftusd )
8791 run (["python3" , "make-spm-tests.py" , "--local" , "--force" ],
8892 cwd = Environment .Path .swiftusd_tests )
8993
90- def get_xcodebuild_destination ():
91- if Environment .TestCombination .target_platform == "macOS" : return "platform=macOS,name=My Mac"
92- elif Environment .TestCombination .target_platform == "iOSSimulator" : return "platform=iOS Simulator,name=iPhone 17 Pro"
93- elif Environment .TestCombination .target_platform == "visionOSSimulator" : return "platform=visionOS Simulator,name=Apple Vision Pro (at 2732x2048)"
94+ def conditionalCommonArgs ():
95+ result = []
96+
97+ def handleJobs (x , singleMinus ):
98+ nonlocal result
99+ try :
100+ if int (x ) > 0 :
101+ result += ["-jobs" if singleMinus else "--jobs" , x ]
102+ except :
103+ pass
104+
105+ def handleDevelopmentTeam ():
106+ nonlocal result
107+ if Environment .TestCombination .at_desk_development_team :
108+ result += [f"DEVELOPMENT_TEAM={ Environment .TestCombination .at_desk_development_team } " ]
109+
110+ if Environment .TestCombination .build_system == "xcodebuild-xcodeproj" :
111+ handleJobs (Environment .TestCombination .at_desk_xcodebuild_jobs , True )
112+ handleDevelopmentTeam ()
113+
114+ elif Environment .TestCombination .build_system == "swiftbuild-SPM-Tests" :
115+ handleJobs (Environment .TestCombination .at_desk_swiftbuild_jobs , False )
116+
117+ elif Environment .TestCombination .build_system == "xcodebuild-SPM-Tests" :
118+ handleJobs (Environment .TestCombination .at_desk_xcodebuild_jobs , True )
119+ handleDevelopmentTeam ()
120+
94121 else :
95- print (f"Error: Unknown target ' { Environment .TestCombination .target_platform } ' " )
122+ print (f"Error: Unknown build system { Environment .TestCombination .build_system } " )
96123 exit (1 )
124+
125+
126+ return result
97127
98128def do_xcodebuild_xcodeproj_tests (action ):
99129 build_or_run_test_suite (
@@ -106,11 +136,11 @@ def do_xcodebuild_xcodeproj_tests(action):
106136 ],
107137 buildTestCommonArgs = [
108138 "-verbose" , "-skipMacroValidation" ,
109- "-scheme" , "UnitTests" ,
139+ "-scheme" , "UnitTests" ,
110140 "-configuration" , Environment .TestCombination .config ,
111- "-destination" , get_xcodebuild_destination () ,
141+ "-destination" , Environment . TestCombination . xcodebuild_destination ,
112142 "OTHER_SWIFT_FLAGS=$(inherited) -DSWIFTUSD_TESTS_SUPPRESS_PERFORMANCE_FAILURES" ,
113- ],
143+ ] + conditionalCommonArgs () ,
114144 cwd = Environment .Path .swiftusd_tests ,
115145 action = action ,
116146 )
@@ -119,10 +149,14 @@ def do_swiftbuild_spm_tests(action):
119149 env = os .environ .copy ()
120150 env ["SWIFT_BACKTRACE" ] = "interactive=no"
121151
122- # Set DEVELOPER_DIR to work around
123- # error: cannot load module 'SwiftCompilerPlugin' built with SDK 'macosx26.0' when using SDK 'macosx26.2'
124- # https://github.com/apple/SwiftUsd/actions/runs/21256906902/job/61175337955
125- env ["DEVELOPER_DIR" ] = "/Applications/Xcode-latest.app"
152+ # todo: revisit this, setting it here means that
153+ # xcodebuild -version in the logs is misleading because
154+ # it's computed without this environment variable
155+ if os .path .exists ("/Applications/Xcode-latest.app" ):
156+ # Set DEVELOPER_DIR to work around
157+ # error: cannot load module 'SwiftCompilerPlugin' built with SDK 'macosx26.0' when using SDK 'macosx26.2'
158+ # https://github.com/apple/SwiftUsd/actions/runs/21256906902/job/61175337955
159+ env ["DEVELOPER_DIR" ] = "/Applications/Xcode-latest.app"
126160
127161 build_or_run_test_suite (
128162 name = "swiftbuild-SPM-Tests" ,
@@ -134,7 +168,7 @@ def do_swiftbuild_spm_tests(action):
134168 "-Xswiftc" , "-DOPENUSD_SWIFT_BUILD_FROM_CLI" , "-Xcxx" , "-DOPENUSD_SWIFT_BUILD_FROM_CLI" ,
135169 "--configuration" , Environment .TestCombination .config .lower (),
136170 "-Xswiftc" , "-DSWIFTUSD_TESTS_SUPPRESS_PERFORMANCE_FAILURES" ,
137- ],
171+ ] + conditionalCommonArgs () ,
138172 cwd = Environment .Path .swiftusd_tests / "SPM-Tests" ,
139173 action = action ,
140174 env = env
@@ -153,9 +187,9 @@ def do_xcodebuild_spm_tests(action):
153187 "-verbose" , "-skipMacroValidation" ,
154188 "-scheme" , "SPM-Tests-Package" ,
155189 "-config" , Environment .TestCombination .config ,
156- "-destination" , get_xcodebuild_destination () ,
190+ "-destination" , Environment . TestCombination . xcodebuild_destination ,
157191 "OTHER_SWIFT_FLAGS=$(inherited) -DSWIFTUSD_TESTS_SUPPRESS_PERFORMANCE_FAILURES" ,
158- ],
192+ ] + conditionalCommonArgs () ,
159193 cwd = Environment .Path .swiftusd_tests / "SPM-Tests" ,
160194 action = action ,
161195 )
@@ -198,4 +232,4 @@ def run_tests(args, subparsers):
198232
199233 args = parser .parse_args ()
200234
201- args .func (args )
235+ args .func (args )
0 commit comments