@@ -1166,6 +1166,47 @@ if platform.system() != 'Darwin':
1166
1166
config .target_resilience_test = ('%s --no-symbol-diff' %
1167
1167
config .target_resilience_test )
1168
1168
1169
+ platform_module_dir = make_path (test_resource_dir , config .target_sdk_name )
1170
+ if run_vendor != 'apple' :
1171
+ platform_module_dir = make_path (platform_module_dir , run_cpu )
1172
+ lit_config .note ('Using platform module dir: ' + platform_module_dir )
1173
+ if test_sdk_overlay_dir :
1174
+ platform_sdk_overlay_dir = test_sdk_overlay_dir
1175
+ else :
1176
+ platform_sdk_overlay_dir = platform_module_dir
1177
+
1178
+ # If static stdlib is present, enable static stdlib tests
1179
+ static_stdlib_path = make_path (config .swift_lib_dir , "swift_static" , config .target_sdk_name )
1180
+ static_libswiftCore_path = make_path (static_stdlib_path , "libswiftCore.a" )
1181
+ if os .path .exists (static_libswiftCore_path ):
1182
+ config .available_features .add ("static_stdlib" )
1183
+ config .substitutions .append (('%target-static-stdlib-path' , static_stdlib_path ))
1184
+ lit_config .note ('using static stdlib path: %s' % static_stdlib_path )
1185
+
1186
+ # Set up testing with the standard libraries coming from the OS / just-built libraries
1187
+ # default Swift tests to use the just-built libraries
1188
+ target_stdlib_path = platform_module_dir
1189
+ if not kIsWindows :
1190
+ if 'use_os_stdlib' not in lit_config .params :
1191
+ lit_config .note ('Testing with the just-built libraries at ' + target_stdlib_path )
1192
+ config .target_run = (
1193
+ "/usr/bin/env "
1194
+ "DYLD_LIBRARY_PATH='{0}' " # Apple option
1195
+ "LD_LIBRARY_PATH='{0}' " # Linux option
1196
+ .format (target_stdlib_path ))
1197
+ else :
1198
+ os_stdlib_path = ''
1199
+ if run_vendor == 'apple' :
1200
+ #If we get swift-in-the-OS for non-Apple platforms, add a condition here
1201
+ os_stdlib_path = "/usr/lib/swift"
1202
+ all_stdlib_path = os .path .pathsep .join ((os_stdlib_path , target_stdlib_path ))
1203
+ lit_config .note ('Testing with the standard libraries coming from the OS ' + all_stdlib_path )
1204
+ config .target_run = (
1205
+ "/usr/bin/env "
1206
+ "DYLD_LIBRARY_PATH='{0}' " # Apple option
1207
+ "LD_LIBRARY_PATH='{0}' " # Linux option
1208
+ .format (all_stdlib_path ))
1209
+
1169
1210
#
1170
1211
# When changing substitutions, update docs/Testing.rst.
1171
1212
#
@@ -1254,13 +1295,6 @@ if hasattr(config, 'target_swift_autolink_extract'):
1254
1295
config .substitutions .append (('%target-swift-modulewrap' ,
1255
1296
config .target_swift_modulewrap ))
1256
1297
1257
- platform_module_dir = make_path (test_resource_dir , '%target-sdk-name' , run_cpu )
1258
- lit_config .note ('Using platform module dir: ' + platform_module_dir )
1259
- if test_sdk_overlay_dir is not None :
1260
- platform_sdk_overlay_dir = make_path (test_sdk_overlay_dir , run_cpu )
1261
- else :
1262
- platform_sdk_overlay_dir = platform_module_dir
1263
-
1264
1298
config .substitutions .insert (0 , ('%platform-module-dir' , platform_module_dir ))
1265
1299
config .substitutions .insert (0 , ('%platform-sdk-overlay-dir' , platform_sdk_overlay_dir ))
1266
1300
@@ -1284,37 +1318,6 @@ config.substitutions.append(
1284
1318
pipes .quote (config .filecheck ))))
1285
1319
config .substitutions .append (('%raw-FileCheck' , pipes .quote (config .filecheck )))
1286
1320
1287
- # If static stdlib is present, enable static stdlib tests
1288
- static_stdlib_path = make_path (config .swift_lib_dir , "swift_static" , config .target_sdk_name )
1289
- libswiftCore_path = make_path (static_stdlib_path , "libswiftCore.a" )
1290
- if os .path .exists (libswiftCore_path ):
1291
- config .available_features .add ("static_stdlib" )
1292
- config .substitutions .append (('%target-static-stdlib-path' , static_stdlib_path ))
1293
- lit_config .note ('using static stdlib path: %s' % static_stdlib_path )
1294
-
1295
- # Set up testing with the standard libraries coming from the OS / just-built libraries
1296
- # default Swift tests to use the just-built libraries
1297
- target_stdlib_path = platform_module_dir
1298
- if 'use_os_stdlib' not in lit_config .params :
1299
- lit_config .note ('Testing with the just-built libraries at ' + target_stdlib_path )
1300
- config .target_run = (
1301
- "/usr/bin/env "
1302
- "DYLD_LIBRARY_PATH='{0}' " # Apple option
1303
- "LD_LIBRARY_PATH='{0}' " # Linux option
1304
- .format (target_stdlib_path ))
1305
- else :
1306
- os_stdlib_path = ''
1307
- if run_vendor == 'apple' :
1308
- #If we get swift-in-the-OS for non-Apple platforms, add a condition here
1309
- os_stdlib_path = "/usr/lib/swift"
1310
- all_stdlib_path = os .path .pathsep .join ((os_stdlib_path , target_stdlib_path ))
1311
- lit_config .note ('Testing with the standard libraries coming from the OS ' + all_stdlib_path )
1312
- config .target_run = (
1313
- "/usr/bin/env "
1314
- "DYLD_LIBRARY_PATH='{0}' " # Apple option
1315
- "LD_LIBRARY_PATH='{0}' " # Linux option
1316
- .format (all_stdlib_path ))
1317
-
1318
1321
if config .lldb_build_root != "" :
1319
1322
config .available_features .add ('lldb' )
1320
1323
# Note: using the same approach to locating the lib dir as in
0 commit comments