@@ -940,6 +940,7 @@ config.target_cxx_lib = '-lc++'
940
940
config .target_msvc_runtime_opt = ''
941
941
config .target_static_library_prefix = 'lib'
942
942
config .target_static_library_suffix = '.a'
943
+ config .target_env_prefix = ''
943
944
944
945
if run_vendor == 'apple' :
945
946
target_specific_module_triple = '{}-apple-{}' .format (
@@ -1080,6 +1081,8 @@ if run_vendor == 'apple':
1080
1081
xcrun_sdk_name = "watchos"
1081
1082
target_future_version = "9.99.0"
1082
1083
1084
+ config .target_env_prefix = 'IOS_CHILD_'
1085
+
1083
1086
config .target_cc_options = (
1084
1087
"-target %s %s" %
1085
1088
(config .variant_triple , clang_mcp_opt ))
@@ -1122,6 +1125,8 @@ if run_vendor == 'apple':
1122
1125
1123
1126
target_specific_module_triple += "-simulator"
1124
1127
1128
+ config .target_env_prefix = 'SIMCTL_CHILD_'
1129
+
1125
1130
config .target_cc_options = (
1126
1131
"-target %s %s" %
1127
1132
(config .variant_triple , clang_mcp_opt ))
@@ -1330,6 +1335,7 @@ elif run_os in ['windows-msvc']:
1330
1335
config .target_msvc_runtime_opt = '-%s -D_MT' % config .swift_stdlib_msvc_runtime
1331
1336
if 'D' in config .swift_stdlib_msvc_runtime :
1332
1337
config .target_msvc_runtime_opt += ' -D_DLL'
1338
+ config .target_env_prefix = ''
1333
1339
1334
1340
config .target_build_swift = \
1335
1341
('%r -target %s %s %s %s %s -libc %s' % \
@@ -1439,6 +1445,7 @@ elif (run_os in ['linux-gnu', 'linux-gnueabihf', 'freebsd', 'openbsd', 'windows-
1439
1445
config .target_shared_library_suffix = ".so"
1440
1446
config .target_sdk_name = "android"
1441
1447
config .target_cc_options = "-fPIE"
1448
+ config .target_env_prefix = 'ANDROID_CHILD_'
1442
1449
else :
1443
1450
lit_config .note ("Testing Linux " + config .variant_triple )
1444
1451
config .target_object_format = "elf"
@@ -1572,6 +1579,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
1572
1579
config .target_runtime = "native"
1573
1580
config .target_swift_autolink_extract = inferSwiftBinary ("swift-autolink-extract" )
1574
1581
config .target_sdk_name = "android"
1582
+ config .target_env_prefix = 'ANDROID_CHILD_'
1575
1583
config .resource_dir_opt = ("-resource-dir %s" % test_resource_dir )
1576
1584
# Since NDK r19, the headers and libraries are available in a unified
1577
1585
# sysroot at $NDK_PATH/toolchains/llvm/prebuilt/$prebuilt_directory/sysroot,
@@ -1775,19 +1783,6 @@ config.substitutions.append(('%string_processing_module', string_processing_modu
1775
1783
config .substitutions .append (('%/string_processing_module' ,
1776
1784
'/' .join (os .path .normpath (string_processing_module ).split (os .sep ))))
1777
1785
1778
- # Different OS's require different prefixes for the environment variables to be
1779
- # propagated to the calling contexts.
1780
- # In order to make tests OS-agnostic, names of environment variables should be
1781
- # prefixed with `%env-`, which is then expanded to the appropriate prefix.
1782
- SIMULATOR_ENV_PREFIX = 'SIMCTL_CHILD_'
1783
- ENV_VAR_PREFIXES = {
1784
- 'iphonesimulator' : SIMULATOR_ENV_PREFIX ,
1785
- 'watchsimulator' : SIMULATOR_ENV_PREFIX ,
1786
- 'appletvsimulator' : SIMULATOR_ENV_PREFIX ,
1787
- 'android' : 'ANDROID_CHILD_'
1788
- }
1789
- TARGET_ENV_PREFIX = ENV_VAR_PREFIXES .get (config .target_sdk_name , "" ) if not kIsAndroid else ""
1790
-
1791
1786
back_deployment_runtime = lit_config .params .get ('back_deployment_runtime' , None )
1792
1787
if back_deployment_runtime is not None :
1793
1788
config .available_features .add ('back_deployment_runtime' )
@@ -1861,6 +1856,7 @@ if 'remote_run_host' in lit_config.params:
1861
1856
os .path .dirname (local_swift_reflection_test ),
1862
1857
'bin/' )
1863
1858
1859
+ config .target_env_prefix = 'REMOTE_RUN_CHILD_'
1864
1860
config .target_run = (
1865
1861
"/usr/bin/env "
1866
1862
"REMOTE_RUN_CHILD_DYLD_LIBRARY_PATH='{0}' " # Apple option
@@ -1874,10 +1870,14 @@ if 'remote_run_host' in lit_config.params:
1874
1870
remote_run_host ))
1875
1871
config .target_swift_reflection_test = os .path .join (
1876
1872
remote_tmp_dir , 'bin' , swift_reflection_test_name )
1877
- TARGET_ENV_PREFIX = 'REMOTE_RUN_CHILD_'
1878
1873
config .available_features .add ('remote_run' )
1879
1874
1880
- config .substitutions .append (('%env-' , TARGET_ENV_PREFIX ))
1875
+ # Different OS's require different prefixes for the environment variables to be
1876
+ # propagated to the calling contexts.
1877
+ # In order to make tests OS-agnostic, names of environment variables should be
1878
+ # prefixed with `%env-`, which is then expanded to the appropriate prefix.
1879
+ config .substitutions .append (('%env-' , config .target_env_prefix ))
1880
+
1881
1881
config .substitutions .append (("%target-sdk-name" , config .target_sdk_name ))
1882
1882
1883
1883
simulator_sdks = [
@@ -2410,7 +2410,7 @@ config.substitutions.append(('%import-static-libdispatch', getattr(config, 'impo
2410
2410
config .environment ['SWIFT_DEBUG_ENABLE_COW_CHECKS' ] = 'false'
2411
2411
2412
2412
# Add this to the command which runs an executable to enable COW checks in the swift runtime.
2413
- config .substitutions .append (('%enable-cow-checking' , TARGET_ENV_PREFIX + 'SWIFT_DEBUG_ENABLE_COW_CHECKS=true;' ))
2413
+ config .substitutions .append (('%enable-cow-checking' , config . target_env_prefix + 'SWIFT_DEBUG_ENABLE_COW_CHECKS=true;' ))
2414
2414
2415
2415
# We add an expansion to ensure that migrator tests can search for the api diff
2416
2416
# data dir from the host compiler toolchain instead of the resource dir of the
@@ -2445,10 +2445,10 @@ if config.lldb_build_root != "":
2445
2445
# Disable randomized hash seeding by default. Tests need to manually opt in to
2446
2446
# random seeds by unsetting the SWIFT_DETERMINISTIC_HASHING environment
2447
2447
# variable.
2448
- config .environment [TARGET_ENV_PREFIX + 'SWIFT_DETERMINISTIC_HASHING' ] = '1'
2448
+ config .environment [config . target_env_prefix + 'SWIFT_DETERMINISTIC_HASHING' ] = '1'
2449
2449
2450
2450
# Enable malloc scribble during tests by default.
2451
- config .environment [TARGET_ENV_PREFIX + 'SWIFT_DEBUG_ENABLE_MALLOC_SCRIBBLE' ] = 'YES'
2451
+ config .environment [config . target_env_prefix + 'SWIFT_DEBUG_ENABLE_MALLOC_SCRIBBLE' ] = 'YES'
2452
2452
2453
2453
# Run lsb_release on the target to be tested and return the results.
2454
2454
def linux_get_lsb_release ():
0 commit comments