@@ -986,7 +986,7 @@ else:
986
986
swift_reflection_test_name = 'swift-reflection-test' + variant_suffix
987
987
988
988
def use_interpreter_for_simple_runs ():
989
- def make_simple_target_run (gyb = False , stdlib = False , parameterized = False ):
989
+ def make_simple_target_run (gyb = False , stdlib = False , parameterized = False , leaks = False ):
990
990
result = ''
991
991
if gyb :
992
992
result += ('%empty-directory(%t) && '
@@ -1014,6 +1014,7 @@ def use_interpreter_for_simple_runs():
1014
1014
config .target_run_stdlib_swift = make_simple_target_run (stdlib = True )
1015
1015
config .target_run_simple_swift = make_simple_target_run ()
1016
1016
config .target_run_simple_swift_parameterized = make_simple_target_run (parameterized = True )
1017
+ config .target_run_simple_leaks_swift_parameterized = make_simple_leaks_target_run (parameterized = True )
1017
1018
config .target_run_stdlib_swift_parameterized = make_simple_target_run (stdlib = True , parameterized = True )
1018
1019
config .target_run_simple_swiftgyb_parameterized = make_simple_target_run (gyb = True , parameterized = True )
1019
1020
config .available_features .add ('interpret' )
@@ -2258,6 +2259,11 @@ elif not kIsWindows:
2258
2259
lit_config .note ('Testing with the just-built libraries' )
2259
2260
2260
2261
lit_config .note ('Library load path: {0}' .format (os .path .pathsep .join (target_stdlib_path )))
2262
+ config .target_run_with_leaks = (
2263
+ "/usr/bin/env " +
2264
+ construct_library_path_env (target_stdlib_path ) +
2265
+ " xcrun leaks -atExit -- " +
2266
+ config .target_run )
2261
2267
config .target_run = (
2262
2268
"/usr/bin/env " +
2263
2269
construct_library_path_env (target_stdlib_path ) +
@@ -2293,6 +2299,16 @@ if not getattr(config, 'target_run_simple_swift', None):
2293
2299
escape_for_substitute_captures (config .target_codesign ),
2294
2300
escape_for_substitute_captures (config .target_run ))
2295
2301
)
2302
+ config .target_run_simple_leaks_swift_parameterized = SubstituteCaptures (
2303
+ r"%%empty-directory(%%t) && "
2304
+ r"%s %s %%s \1 -o %%t/a.out -module-name main && "
2305
+ r"%s %%t/a.out && "
2306
+ r"%s %%t/a.out"
2307
+ % (escape_for_substitute_captures (config .target_build_swift ),
2308
+ escape_for_substitute_captures (mcp_opt ),
2309
+ escape_for_substitute_captures (config .target_codesign ),
2310
+ escape_for_substitute_captures (config .target_run_with_leaks ))
2311
+ )
2296
2312
config .target_fail_simple_swift_parameterized = SubstituteCaptures (
2297
2313
r"%%empty-directory(%%t) && "
2298
2314
r"%s %s %%s \1 -o %%t/a.out -module-name main && "
@@ -2468,6 +2484,8 @@ config.substitutions.append(('%target-run-simple-swiftgyb\(([^)]+)\)',
2468
2484
config .substitutions .append (('%target-run-simple-swiftgyb' , config .target_run_simple_swiftgyb ))
2469
2485
config .substitutions .append (('%target-run-simple-swift\(([^)]+)\)' ,
2470
2486
config .target_run_simple_swift_parameterized ))
2487
+ config .substitutions .append (('%target-run-simple-leaks-swift\(([^)]+)\)' ,
2488
+ config .target_run_simple_leaks_swift_parameterized ))
2471
2489
config .substitutions .append (('%target-fail-simple-swift\(([^)]+)\)' ,
2472
2490
config .target_fail_simple_swift_parameterized ))
2473
2491
config .substitutions .append (('%target-run-stdlib-swift\(([^)]+)\)' ,
0 commit comments