@@ -1006,7 +1006,7 @@ else:
10061006swift_reflection_test_name = 'swift-reflection-test' + variant_suffix
10071007
10081008def 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 ):
10101010 result = ''
10111011 if gyb :
10121012 result += ('%empty-directory(%t) && '
@@ -1034,6 +1034,7 @@ def use_interpreter_for_simple_runs():
10341034 config .target_run_stdlib_swift = make_simple_target_run (stdlib = True )
10351035 config .target_run_simple_swift = make_simple_target_run ()
10361036 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 )
10371038 config .target_run_stdlib_swift_parameterized = make_simple_target_run (stdlib = True , parameterized = True )
10381039 config .target_run_simple_swiftgyb_parameterized = make_simple_target_run (gyb = True , parameterized = True )
10391040 config .available_features .add ('interpret' )
@@ -2272,6 +2273,11 @@ elif not kIsWindows:
22722273 lit_config .note ('Testing with the just-built libraries' )
22732274
22742275 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 )
22752281 config .target_run = (
22762282 "/usr/bin/env " +
22772283 construct_library_path_env (target_stdlib_path ) +
@@ -2307,6 +2313,16 @@ if not getattr(config, 'target_run_simple_swift', None):
23072313 escape_for_substitute_captures (config .target_codesign ),
23082314 escape_for_substitute_captures (config .target_run ))
23092315 )
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+ )
23102326 config .target_fail_simple_swift_parameterized = SubstituteCaptures (
23112327 r"%%empty-directory(%%t) && "
23122328 r"%s %s %%s \1 -o %%t/a.out -module-name main && "
@@ -2482,6 +2498,8 @@ config.substitutions.append(('%target-run-simple-swiftgyb\(([^)]+)\)',
24822498config .substitutions .append (('%target-run-simple-swiftgyb' , config .target_run_simple_swiftgyb ))
24832499config .substitutions .append (('%target-run-simple-swift\(([^)]+)\)' ,
24842500 config .target_run_simple_swift_parameterized ))
2501+ config .substitutions .append (('%target-run-simple-leaks-swift\(([^)]+)\)' ,
2502+ config .target_run_simple_leaks_swift_parameterized ))
24852503config .substitutions .append (('%target-fail-simple-swift\(([^)]+)\)' ,
24862504 config .target_fail_simple_swift_parameterized ))
24872505config .substitutions .append (('%target-run-stdlib-swift\(([^)]+)\)' ,
0 commit comments