for f in additional_features.split(','):
self.config.available_features.add(f.strip())
- # Write an "available feature" that combines the triple when
- # use_system_cxx_lib is enabled. This is so that we can easily write
- # XFAIL markers for tests that are known to fail with versions of
- # libc++ as were shipped with a particular triple.
- if self.use_system_cxx_lib:
- (arch, vendor, platform) = self.config.target_triple.split('-', 2)
- (sysname, version) = re.match(r'([^0-9]+)([0-9\.]*)', platform).groups()
-
- self.config.available_features.add('with_system_cxx_lib={}-{}-{}{}'.format(arch, vendor, sysname, version))
- self.config.available_features.add('with_system_cxx_lib={}{}'.format(sysname, version))
- self.config.available_features.add('with_system_cxx_lib={}'.format(sysname))
-
if self.target_info.is_windows():
if self.cxx_stdlib_under_test == 'libc++':
# LIBCXX-WINDOWS-FIXME is the feature name used to XFAIL the
support_path = os.path.join(self.libcxx_src_root, 'test/support')
self.cxx.compile_flags += ['-I' + support_path]
- # If we're testing the upstream LLVM libc++, disable availability markup,
- # which is not relevant for non-shipped flavors of libc++.
- if not self.use_system_cxx_lib:
- self.cxx.compile_flags += ['-D_LIBCPP_DISABLE_AVAILABILITY']
-
# On GCC, the libc++ headers cause errors due to throw() decorators
# on operator new clashing with those from the test suite, so we
# don't enable warnings in system headers on GCC.
#===----------------------------------------------------------------------===##
from libcxx.test.dsl import *
+import re
import sys
_isClang = lambda cfg: '__clang__' in compilerMacros(cfg) and '__apple_build_version__' not in compilerMacros(cfg)
Feature(name='linux', when=lambda cfg: '__linux__' in compilerMacros(cfg)),
Feature(name='netbsd', when=lambda cfg: '__NetBSD__' in compilerMacros(cfg))
]
+
+
+# When vendor-specific availability annotations are enabled, add Lit features
+# with various forms of the target triple to make it easier to write XFAIL or
+# UNSUPPORTED markup for tests that are known to fail on a particular triple.
+#
+# TODO: This is very unclean -- we assume that the 'use_system_cxx_lib' parameter
+# is set before this feature gets detected, and we also set a dummy name
+# for the main feature. We also take for granted that `target_triple`
+# exists in the config object. This should be refactored so that the
+# 'use_system_cxx_lib' Parameter can set these features itself.
+def _addSystemCxxLibDeclinations(cfg):
+ (arch, vendor, platform) = cfg.target_triple.split('-', 2)
+ (sysname, version) = re.match(r'([^0-9]+)([0-9\.]*)', platform).groups()
+ return [
+ AddFeature('with_system_cxx_lib={}-{}-{}{}'.format(arch, vendor, sysname, version)),
+ AddFeature('with_system_cxx_lib={}{}'.format(sysname, version)),
+ AddFeature('with_system_cxx_lib={}'.format(sysname)),
+ ]
+DEFAULT_FEATURES += [
+ Feature(name='__dummy_use_system_cxx_lib',
+ when=lambda cfg: 'use_system_cxx_lib' in cfg.available_features,
+ actions=_addSystemCxxLibDeclinations)
+]
AddOptionalWarningFlag(w) for w in _warningFlags
]),
+ Parameter(name='use_system_cxx_lib', choices=[True, False], type=bool, default=False,
+ help="Whether the test suite is being *run* against the library shipped on "
+ "the target triple in use, as opposed to the trunk library.",
+ actions=lambda useSystem: [
+ # TODO: Remove this, see comment in features.py
+ AddFeature('use_system_cxx_lib')
+ ] if useSystem else [
+ # If we're testing upstream libc++, disable availability markup,
+ # which is not relevant for non-shipped flabors of libc++.
+ AddCompileFlag('-D_LIBCPP_DISABLE_AVAILABILITY')
+ ]),
+
# Parameters to enable or disable parts of the test suite
Parameter(name='enable_filesystem', choices=[True, False], type=bool, default=True,
help="Whether to enable tests for the C++ <filesystem> library.",