Skip to content

Commit 1ad5b70

Browse files
authored
Merge pull request #23570 from apple/libdispatch-tests-stub
[lit] Stub out lit feature detection on non-Apple platforms
2 parents 3320823 + ff16bb8 commit 1ad5b70

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

test/lit.cfg

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,6 @@ if run_vendor == 'apple':
645645
{ 'macosx': 'macos', 'darwin': 'macos' }.get(run_os, run_os)
646646
)
647647

648-
config.available_features.add('libdispatch')
649-
config.available_features.add('foundation')
650-
config.available_features.add('objc_interop')
651-
652648
config.target_object_format = "macho"
653649
config.target_shared_library_prefix = 'lib'
654650
config.target_shared_library_suffix = ".dylib"
@@ -1488,4 +1484,25 @@ if platform.system() == 'Linux':
14881484
config.available_features.add("LinuxDistribution=" + distributor + '-' + release)
14891485
lit_config.note('Running tests on %s-%s' % (distributor, release))
14901486

1487+
if run_vendor == 'apple':
1488+
config.available_features.add('libdispatch')
1489+
config.available_features.add('foundation')
1490+
config.available_features.add('objc_interop')
1491+
else:
1492+
# TODO(yln): Works with the packaged swift distribution, but not during build.
1493+
# We need to make libdispatch/foundation available in the test resource directory
1494+
# or pass along the proper library include paths in the compiler invocations that are used
1495+
# to build the tests.
1496+
def has_lib(name):
1497+
return False
1498+
1499+
if has_lib('dispatch'):
1500+
config.available_features.add('libdispatch')
1501+
else:
1502+
# TSan runtime requires libdispatch on non-Apple platforms
1503+
config.available_features.remove('tsan_runtime')
1504+
1505+
if has_lib('Foundation'):
1506+
config.available_features.add('foundation')
1507+
14911508
lit_config.note("Available features: " + ", ".join(sorted(config.available_features)))

0 commit comments

Comments
 (0)