@@ -1006,7 +1006,7 @@ else:
1006
1006
swift_reflection_test_name = 'swift-reflection-test' + variant_suffix
1007
1007
1008
1008
def use_interpreter_for_simple_runs ():
1009
- def make_simple_target_run (gyb = False , stdlib = False , parameterized = False ):
1009
+ def make_simple_target_run (gyb = False , stdlib = False , parameterized = False , leaks = False ):
1010
1010
result = ''
1011
1011
if gyb :
1012
1012
result += ('%empty-directory(%t) && '
@@ -1034,6 +1034,7 @@ def use_interpreter_for_simple_runs():
1034
1034
config .target_run_stdlib_swift = make_simple_target_run (stdlib = True )
1035
1035
config .target_run_simple_swift = make_simple_target_run ()
1036
1036
config .target_run_simple_swift_parameterized = make_simple_target_run (parameterized = True )
1037
+ config .target_run_simple_leaks_swift_parameterized = make_simple_leaks_target_run (parameterized = True )
1037
1038
config .target_run_stdlib_swift_parameterized = make_simple_target_run (stdlib = True , parameterized = True )
1038
1039
config .target_run_simple_swiftgyb_parameterized = make_simple_target_run (gyb = True , parameterized = True )
1039
1040
config .available_features .add ('interpret' )
@@ -2278,6 +2279,11 @@ elif not kIsWindows:
2278
2279
lit_config .note ('Testing with the just-built libraries' )
2279
2280
2280
2281
lit_config .note ('Library load path: {0}' .format (os .path .pathsep .join (target_stdlib_path )))
2282
+ config .target_run_with_leaks = (
2283
+ "/usr/bin/env " +
2284
+ construct_library_path_env (target_stdlib_path ) +
2285
+ " xcrun leaks -atExit -- " +
2286
+ config .target_run )
2281
2287
config .target_run = (
2282
2288
"/usr/bin/env " +
2283
2289
construct_library_path_env (target_stdlib_path ) +
@@ -2313,6 +2319,16 @@ if not getattr(config, 'target_run_simple_swift', None):
2313
2319
escape_for_substitute_captures (config .target_codesign ),
2314
2320
escape_for_substitute_captures (config .target_run ))
2315
2321
)
2322
+ config .target_run_simple_leaks_swift_parameterized = SubstituteCaptures (
2323
+ r"%%empty-directory(%%t) && "
2324
+ r"%s %s %%s \1 -o %%t/a.out -module-name main && "
2325
+ r"%s %%t/a.out && "
2326
+ r"%s %%t/a.out"
2327
+ % (escape_for_substitute_captures (config .target_build_swift ),
2328
+ escape_for_substitute_captures (mcp_opt ),
2329
+ escape_for_substitute_captures (config .target_codesign ),
2330
+ escape_for_substitute_captures (config .target_run_with_leaks ))
2331
+ )
2316
2332
config .target_fail_simple_swift_parameterized = SubstituteCaptures (
2317
2333
r"%%empty-directory(%%t) && "
2318
2334
r"%s %s %%s \1 -o %%t/a.out -module-name main && "
@@ -2488,6 +2504,8 @@ config.substitutions.append(('%target-run-simple-swiftgyb\(([^)]+)\)',
2488
2504
config .substitutions .append (('%target-run-simple-swiftgyb' , config .target_run_simple_swiftgyb ))
2489
2505
config .substitutions .append (('%target-run-simple-swift\(([^)]+)\)' ,
2490
2506
config .target_run_simple_swift_parameterized ))
2507
+ config .substitutions .append (('%target-run-simple-leaks-swift\(([^)]+)\)' ,
2508
+ config .target_run_simple_leaks_swift_parameterized ))
2491
2509
config .substitutions .append (('%target-fail-simple-swift\(([^)]+)\)' ,
2492
2510
config .target_fail_simple_swift_parameterized ))
2493
2511
config .substitutions .append (('%target-run-stdlib-swift\(([^)]+)\)' ,
0 commit comments