@@ -1008,7 +1008,7 @@ else:
1008
1008
swift_reflection_test_name = 'swift-reflection-test' + variant_suffix
1009
1009
1010
1010
def use_interpreter_for_simple_runs ():
1011
- def make_simple_target_run (gyb = False , stdlib = False , parameterized = False ):
1011
+ def make_simple_target_run (gyb = False , stdlib = False , parameterized = False , leaks = False ):
1012
1012
result = ''
1013
1013
if gyb :
1014
1014
result += ('%empty-directory(%t) && '
@@ -1036,6 +1036,7 @@ def use_interpreter_for_simple_runs():
1036
1036
config .target_run_stdlib_swift = make_simple_target_run (stdlib = True )
1037
1037
config .target_run_simple_swift = make_simple_target_run ()
1038
1038
config .target_run_simple_swift_parameterized = make_simple_target_run (parameterized = True )
1039
+ config .target_run_simple_leaks_swift_parameterized = make_simple_leaks_target_run (parameterized = True )
1039
1040
config .target_run_stdlib_swift_parameterized = make_simple_target_run (stdlib = True , parameterized = True )
1040
1041
config .target_run_simple_swiftgyb_parameterized = make_simple_target_run (gyb = True , parameterized = True )
1041
1042
config .available_features .add ('interpret' )
@@ -2273,6 +2274,11 @@ elif not kIsWindows:
2273
2274
lit_config .note ('Testing with the just-built libraries' )
2274
2275
2275
2276
lit_config .note ('Library load path: {0}' .format (os .path .pathsep .join (target_stdlib_path )))
2277
+ config .target_run_with_leaks = (
2278
+ "/usr/bin/env " +
2279
+ construct_library_path_env (target_stdlib_path ) +
2280
+ " xcrun leaks -atExit -- " +
2281
+ config .target_run )
2276
2282
config .target_run = (
2277
2283
"/usr/bin/env " +
2278
2284
construct_library_path_env (target_stdlib_path ) +
@@ -2308,6 +2314,16 @@ if not getattr(config, 'target_run_simple_swift', None):
2308
2314
escape_for_substitute_captures (config .target_codesign ),
2309
2315
escape_for_substitute_captures (config .target_run ))
2310
2316
)
2317
+ config .target_run_simple_leaks_swift_parameterized = SubstituteCaptures (
2318
+ r"%%empty-directory(%%t) && "
2319
+ r"%s %s %%s \1 -o %%t/a.out -module-name main && "
2320
+ r"%s %%t/a.out && "
2321
+ r"%s %%t/a.out"
2322
+ % (escape_for_substitute_captures (config .target_build_swift ),
2323
+ escape_for_substitute_captures (mcp_opt ),
2324
+ escape_for_substitute_captures (config .target_codesign ),
2325
+ escape_for_substitute_captures (config .target_run_with_leaks ))
2326
+ )
2311
2327
config .target_fail_simple_swift_parameterized = SubstituteCaptures (
2312
2328
r"%%empty-directory(%%t) && "
2313
2329
r"%s %s %%s \1 -o %%t/a.out -module-name main && "
@@ -2483,6 +2499,8 @@ config.substitutions.append(('%target-run-simple-swiftgyb\(([^)]+)\)',
2483
2499
config .substitutions .append (('%target-run-simple-swiftgyb' , config .target_run_simple_swiftgyb ))
2484
2500
config .substitutions .append (('%target-run-simple-swift\(([^)]+)\)' ,
2485
2501
config .target_run_simple_swift_parameterized ))
2502
+ config .substitutions .append (('%target-run-simple-leaks-swift\(([^)]+)\)' ,
2503
+ config .target_run_simple_leaks_swift_parameterized ))
2486
2504
config .substitutions .append (('%target-fail-simple-swift\(([^)]+)\)' ,
2487
2505
config .target_fail_simple_swift_parameterized ))
2488
2506
config .substitutions .append (('%target-run-stdlib-swift\(([^)]+)\)' ,
0 commit comments