12
12
#
13
13
# This is a configuration file for the 'lit' test runner.
14
14
#
15
- # Refer to docs/Testing.rst for documentation.
15
+ # Refer to docs/Testing.md for documentation.
16
16
#
17
- # Update docs/Testing.rst when changing this file.
17
+ # Update docs/Testing.md when changing this file.
18
18
#
19
19
# -----------------------------------------------------------------------------
20
20
@@ -605,6 +605,10 @@ def use_interpreter_for_simple_runs():
605
605
config .target_run_simple_swift = make_simple_target_run ()
606
606
config .available_features .add ('interpret' )
607
607
608
+ target_specific_module_triple = config .variant_triple
609
+
610
+ config .target_run = ""
611
+
608
612
if run_vendor == 'apple' :
609
613
config .available_features .add ('objc_interop' )
610
614
config .target_object_format = "macho"
@@ -925,6 +929,15 @@ if (not getattr(config, 'target_run', None) and
925
929
remote_run_host = lit_config .params ['remote_run_host' ]
926
930
remote_tmp_dir = lit_config .params ['remote_run_tmpdir' ]
927
931
remote_lib_dir = os .path .join (remote_tmp_dir , 'stdlib' )
932
+ remote_run_lib_path = ''
933
+ if 'use_os_stdlib' not in lit_config .params :
934
+ remote_run_lib_path = remote_lib_dir
935
+ else :
936
+ os_stdlib_path = ''
937
+ if run_vendor == 'apple' :
938
+ #If we get swift-in-the-OS for non-Apple platforms, add a condition here
939
+ os_stdlib_path = "/usr/lib/swift"
940
+ remote_run_lib_path = os .path .pathsep .join ((os_stdlib_path , remote_lib_dir ))
928
941
929
942
remote_run_extra_args_param = lit_config .params .get ('remote_run_extra_args' )
930
943
remote_run_extra_args = shlex .split (remote_run_extra_args_param or '' )
@@ -973,7 +986,7 @@ if (not getattr(config, 'target_run', None) and
973
986
"REMOTE_RUN_CHILD_DYLD_LIBRARY_PATH='{0}' " # Apple option
974
987
"REMOTE_RUN_CHILD_LD_LIBRARY_PATH='{0}' " # Linux option
975
988
"'{1}'/remote-run --input-prefix '{2}' --output-prefix %t "
976
- "--remote-dir '{3}'%t {4} {5}" .format (remote_lib_dir ,
989
+ "--remote-dir '{3}'%t {4} {5}" .format (remote_run_lib_path ,
977
990
config .swift_utils ,
978
991
config .swift_src_root ,
979
992
remote_tmp_dir ,
@@ -1064,61 +1077,16 @@ if sftp_server_path:
1064
1077
config .substitutions .append (('%sftp-server' ,
1065
1078
sftp_server_path or 'no-sftp-server' ))
1066
1079
1067
-
1068
- if not getattr (config , 'target_run_simple_swift' , None ):
1069
- config .target_run_simple_swift = (
1070
- '%%empty-directory(%%t) && '
1071
- '%s %s %%s -o %%t/a.out -module-name main && '
1072
- '%s %%t/a.out &&'
1073
- '%s %%t/a.out'
1074
- % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1075
- config .target_run_simple_opt_O_swift = (
1076
- '%%empty-directory(%%t) && '
1077
- '%s %s -O %%s -o %%t/a.out -module-name main && '
1078
- '%s %%t/a.out &&'
1079
- '%s %%t/a.out'
1080
- % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1081
- config .target_run_simple_opt_Osize_swift = (
1082
- '%%empty-directory(%%t) && '
1083
- '%s %s -Osize %%s -o %%t/a.out -module-name main && '
1084
- '%s %%t/a.out &&'
1085
- '%s %%t/a.out'
1086
- % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1087
- config .target_run_stdlib_swift = (
1088
- '%%empty-directory(%%t) && '
1089
- '%s %s %%s -o %%t/a.out -module-name main '
1090
- '-Xfrontend -disable-access-control && '
1091
- '%s %%t/a.out &&'
1092
- '%s %%t/a.out'
1093
- % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1094
- config .target_run_simple_swiftgyb = (
1095
- '%%empty-directory(%%t) && '
1096
- '%%gyb %%s -o %%t/main.swift && '
1097
- '%%line-directive %%t/main.swift -- '
1098
- '%s %s %%t/main.swift -o %%t/a.out -module-name main && '
1099
- '%s %%t/a.out &&'
1100
- '%%line-directive %%t/main.swift -- '
1101
- '%s %%t/a.out'
1102
- % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1103
- config .target_run_stdlib_swiftgyb = (
1104
- '%%empty-directory(%%t) && '
1105
- '%%gyb %%s -o %%t/main.swift && '
1106
- '%%line-directive %%t/main.swift -- '
1107
- '%s %s %%t/main.swift -o %%t/a.out -module-name main '
1108
- '-Xfrontend -disable-access-control && '
1109
- '%s %%t/a.out &&'
1110
- '%%line-directive %%t/main.swift -- '
1111
- '%s %%t/a.out'
1112
- % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1113
-
1114
1080
subst_target_jit_run = ""
1115
1081
if 'swift_interpreter' in config .available_features :
1116
1082
subst_target_jit_run = (
1117
1083
"%s -interpret %s" %
1118
1084
(config .target_swift_frontend , sdk_overlay_link_path ))
1119
1085
1086
+ subst_target_repl_run_swift = ""
1120
1087
subst_target_repl_run_simple_swift = ""
1121
1088
if 'swift_repl' in config .available_features :
1089
+ subst_target_repl_run_swift = "%s -repl" % (config .target_swift_frontend )
1122
1090
subst_target_repl_run_simple_swift = (
1123
1091
"%s -repl %s < %%s 2>&1" %
1124
1092
(config .target_swift_frontend , sdk_overlay_link_path ))
@@ -1157,6 +1125,111 @@ if platform.system() != 'Darwin':
1157
1125
config .target_resilience_test = ('%s --no-symbol-diff' %
1158
1126
config .target_resilience_test )
1159
1127
1128
+ platform_module_dir = make_path (test_resource_dir , config .target_sdk_name )
1129
+ if run_vendor != 'apple' :
1130
+ platform_module_dir = make_path (platform_module_dir , run_cpu )
1131
+ lit_config .note ('Using platform module dir: ' + platform_module_dir )
1132
+ if test_sdk_overlay_dir :
1133
+ platform_sdk_overlay_dir = test_sdk_overlay_dir
1134
+ else :
1135
+ platform_sdk_overlay_dir = platform_module_dir
1136
+
1137
+ # If static stdlib is present, enable static stdlib tests
1138
+ static_stdlib_path = make_path (config .swift_lib_dir , "swift_static" , config .target_sdk_name )
1139
+ static_libswiftCore_path = make_path (static_stdlib_path , "libswiftCore.a" )
1140
+ if os .path .exists (static_libswiftCore_path ):
1141
+ config .available_features .add ("static_stdlib" )
1142
+ config .substitutions .append (('%target-static-stdlib-path' , static_stdlib_path ))
1143
+ lit_config .note ('using static stdlib path: %s' % static_stdlib_path )
1144
+
1145
+ # Set up testing with the standard libraries coming from the OS / just-built libraries
1146
+ # default Swift tests to use the just-built libraries
1147
+ target_stdlib_path = platform_module_dir
1148
+ if 'use_os_stdlib' not in lit_config .params :
1149
+ lit_config .note ('Testing with the just-built libraries at ' + target_stdlib_path )
1150
+ library_path_env = (
1151
+ "/usr/bin/env "
1152
+ "DYLD_LIBRARY_PATH='{0}' " # Apple option
1153
+ "LD_LIBRARY_PATH='{0}' " # Linux option
1154
+ "SIMCTL_CHILD_DYLD_LIBRARY_PATH='{0}' " # Simulator option
1155
+ .format (target_stdlib_path ))
1156
+ config .target_run = library_path_env + config .target_run
1157
+ subst_target_jit_run = library_path_env + subst_target_jit_run
1158
+ config .swift_remoteast_test = library_path_env + config .swift_remoteast_test
1159
+ subst_target_repl_run_simple_swift = library_path_env + subst_target_repl_run_simple_swift
1160
+ subst_target_repl_run_swift = library_path_env + subst_target_repl_run_swift
1161
+ else :
1162
+ os_stdlib_path = ''
1163
+ if run_vendor == 'apple' :
1164
+ #If we get swift-in-the-OS for non-Apple platforms, add a condition here
1165
+ os_stdlib_path = "/usr/lib/swift"
1166
+ all_stdlib_path = os .path .pathsep .join ((os_stdlib_path , target_stdlib_path ))
1167
+ lit_config .note ('Testing with the standard libraries coming from the OS ' + all_stdlib_path )
1168
+ library_path_env = (
1169
+ "/usr/bin/env "
1170
+ "DYLD_LIBRARY_PATH='{0}' " # Apple option
1171
+ "LD_LIBRARY_PATH='{0}' " # Linux option
1172
+ "SIMCTL_CHILD_DYLD_LIBRARY_PATH='{0}' " # Simulator option
1173
+ .format (all_stdlib_path ))
1174
+ config .target_run = library_path_env + config .target_run
1175
+ subst_target_jit_run = library_path_env + subst_target_jit_run
1176
+ config .swift_remoteast_test = library_path_env + config .swift_remoteast_test
1177
+ subst_target_repl_run_simple_swift = library_path_env + subst_target_repl_run_simple_swift
1178
+ subst_target_repl_run_swift = library_path_env + subst_target_repl_run_swift
1179
+
1180
+ if not getattr (config , 'target_run_simple_swift' , None ):
1181
+ config .target_run_simple_swift_parameterized = \
1182
+ (SubstituteCaptures ('%%empty-directory(%%t) && '
1183
+ '%s %s %%s \\ 1 -o %%t/a.out -module-name main && '
1184
+ '%s %%t/a.out &&'
1185
+ '%s %%t/a.out' % (config .target_build_swift ,
1186
+ mcp_opt , config .target_codesign ,
1187
+ config .target_run )))
1188
+ config .target_run_simple_swift = (
1189
+ '%%empty-directory(%%t) && '
1190
+ '%s %s %%s -o %%t/a.out -module-name main && '
1191
+ '%s %%t/a.out &&'
1192
+ '%s %%t/a.out'
1193
+ % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1194
+ config .target_run_simple_opt_O_swift = (
1195
+ '%%empty-directory(%%t) && '
1196
+ '%s %s -O %%s -o %%t/a.out -module-name main && '
1197
+ '%s %%t/a.out &&'
1198
+ '%s %%t/a.out'
1199
+ % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1200
+ config .target_run_simple_opt_Osize_swift = (
1201
+ '%%empty-directory(%%t) && '
1202
+ '%s %s -Osize %%s -o %%t/a.out -module-name main && '
1203
+ '%s %%t/a.out &&'
1204
+ '%s %%t/a.out'
1205
+ % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1206
+ config .target_run_stdlib_swift = (
1207
+ '%%empty-directory(%%t) && '
1208
+ '%s %s %%s -o %%t/a.out -module-name main '
1209
+ '-Xfrontend -disable-access-control && '
1210
+ '%s %%t/a.out &&'
1211
+ '%s %%t/a.out'
1212
+ % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1213
+ config .target_run_simple_swiftgyb = (
1214
+ '%%empty-directory(%%t) && '
1215
+ '%%gyb %%s -o %%t/main.swift && '
1216
+ '%%line-directive %%t/main.swift -- '
1217
+ '%s %s %%t/main.swift -o %%t/a.out -module-name main && '
1218
+ '%s %%t/a.out &&'
1219
+ '%%line-directive %%t/main.swift -- '
1220
+ '%s %%t/a.out'
1221
+ % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1222
+ config .target_run_stdlib_swiftgyb = (
1223
+ '%%empty-directory(%%t) && '
1224
+ '%%gyb %%s -o %%t/main.swift && '
1225
+ '%%line-directive %%t/main.swift -- '
1226
+ '%s %s %%t/main.swift -o %%t/a.out -module-name main '
1227
+ '-Xfrontend -disable-access-control && '
1228
+ '%s %%t/a.out &&'
1229
+ '%%line-directive %%t/main.swift -- '
1230
+ '%s %%t/a.out'
1231
+ % (config .target_build_swift , mcp_opt , config .target_codesign , config .target_run ))
1232
+
1160
1233
#
1161
1234
# When changing substitutions, update docs/Testing.rst.
1162
1235
#
@@ -1185,6 +1258,7 @@ config.substitutions.append(('%target-run-simple-opt-O-swift', config.target_run
1185
1258
config .substitutions .append (('%target-run-simple-opt-Osize-swift' , config .target_run_simple_opt_Osize_swift ))
1186
1259
config .substitutions .append (('%target-run-stdlib-swiftgyb' , config .target_run_stdlib_swiftgyb ))
1187
1260
config .substitutions .append (('%target-run-stdlib-swift' , config .target_run_stdlib_swift ))
1261
+ config .substitutions .append (('%target-repl-run-swift' , subst_target_repl_run_swift ))
1188
1262
config .substitutions .append (('%target-repl-run-simple-swift' , subst_target_repl_run_simple_swift ))
1189
1263
config .substitutions .append (('%target-run' , config .target_run ))
1190
1264
config .substitutions .append (('%target-jit-run' , subst_target_jit_run ))
@@ -1245,13 +1319,6 @@ if hasattr(config, 'target_swift_autolink_extract'):
1245
1319
config .substitutions .append (('%target-swift-modulewrap' ,
1246
1320
config .target_swift_modulewrap ))
1247
1321
1248
- platform_module_dir = make_path (test_resource_dir , '%target-sdk-name' , run_cpu )
1249
- lit_config .note ('Using platform module dir: ' + platform_module_dir )
1250
- if test_sdk_overlay_dir is not None :
1251
- platform_sdk_overlay_dir = make_path (test_sdk_overlay_dir , run_cpu )
1252
- else :
1253
- platform_sdk_overlay_dir = platform_module_dir
1254
-
1255
1322
config .substitutions .insert (0 , ('%platform-module-dir' , platform_module_dir ))
1256
1323
config .substitutions .insert (0 , ('%platform-sdk-overlay-dir' , platform_sdk_overlay_dir ))
1257
1324
@@ -1275,14 +1342,6 @@ config.substitutions.append(
1275
1342
pipes .quote (config .filecheck ))))
1276
1343
config .substitutions .append (('%raw-FileCheck' , pipes .quote (config .filecheck )))
1277
1344
1278
- # If static stdlib is present, enable static stdlib tests
1279
- static_stdlib_path = make_path (config .swift_lib_dir , "swift_static" , config .target_sdk_name )
1280
- libswiftCore_path = make_path (static_stdlib_path , "libswiftCore.a" )
1281
- if os .path .exists (libswiftCore_path ):
1282
- config .available_features .add ("static_stdlib" )
1283
- config .substitutions .append (('%target-static-stdlib-path' , static_stdlib_path ))
1284
- lit_config .note ('using static stdlib path: %s' % static_stdlib_path )
1285
-
1286
1345
if config .lldb_build_root != "" :
1287
1346
config .available_features .add ('lldb' )
1288
1347
# Note: using the same approach to locating the lib dir as in
0 commit comments