@@ -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' )
@@ -2272,6 +2273,11 @@ elif not kIsWindows:
2272
2273
lit_config .note ('Testing with the just-built libraries' )
2273
2274
2274
2275
lit_config .note ('Library load path: {0}' .format (os .path .pathsep .join (target_stdlib_path )))
2276
+ config .target_run_with_leaks = (
2277
+ "/usr/bin/env " +
2278
+ construct_library_path_env (target_stdlib_path ) +
2279
+ " xcrun leaks -atExit -- " +
2280
+ config .target_run )
2275
2281
config .target_run = (
2276
2282
"/usr/bin/env " +
2277
2283
construct_library_path_env (target_stdlib_path ) +
@@ -2307,6 +2313,16 @@ if not getattr(config, 'target_run_simple_swift', None):
2307
2313
escape_for_substitute_captures (config .target_codesign ),
2308
2314
escape_for_substitute_captures (config .target_run ))
2309
2315
)
2316
+ config .target_run_simple_leaks_swift_parameterized = SubstituteCaptures (
2317
+ r"%%empty-directory(%%t) && "
2318
+ r"%s %s %%s \1 -o %%t/a.out -module-name main && "
2319
+ r"%s %%t/a.out && "
2320
+ r"%s %%t/a.out"
2321
+ % (escape_for_substitute_captures (config .target_build_swift ),
2322
+ escape_for_substitute_captures (mcp_opt ),
2323
+ escape_for_substitute_captures (config .target_codesign ),
2324
+ escape_for_substitute_captures (config .target_run_with_leaks ))
2325
+ )
2310
2326
config .target_fail_simple_swift_parameterized = SubstituteCaptures (
2311
2327
r"%%empty-directory(%%t) && "
2312
2328
r"%s %s %%s \1 -o %%t/a.out -module-name main && "
@@ -2482,6 +2498,8 @@ config.substitutions.append(('%target-run-simple-swiftgyb\(([^)]+)\)',
2482
2498
config .substitutions .append (('%target-run-simple-swiftgyb' , config .target_run_simple_swiftgyb ))
2483
2499
config .substitutions .append (('%target-run-simple-swift\(([^)]+)\)' ,
2484
2500
config .target_run_simple_swift_parameterized ))
2501
+ config .substitutions .append (('%target-run-simple-leaks-swift\(([^)]+)\)' ,
2502
+ config .target_run_simple_leaks_swift_parameterized ))
2485
2503
config .substitutions .append (('%target-fail-simple-swift\(([^)]+)\)' ,
2486
2504
config .target_fail_simple_swift_parameterized ))
2487
2505
config .substitutions .append (('%target-run-stdlib-swift\(([^)]+)\)' ,
0 commit comments