diff --git a/libcxx/test/configs/libcxx-apple-backdeployment.cfg.in b/libcxx/test/configs/libcxx-apple-backdeployment.cfg.in new file mode 100644 --- /dev/null +++ b/libcxx/test/configs/libcxx-apple-backdeployment.cfg.in @@ -0,0 +1,103 @@ +import os +import pipes +import site +import sys +libcxxRoot = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) +site.addsitedir(os.path.join(libcxxRoot, 'utils')) +import libcxx.test.features +import libcxx.test.newformat +import libcxx.test.params + +# The SDK to use when building the test suite. +# +# This must be something that can be used for 'xcrun --sdk <...>', as it +# is used to select the right underlying SDK and the right toolchain for +# building the test suite. +SDK = lit_config.params['sdk'] + +# The path to use for linking against libc++ and finding its headers. +# +# This should follow the same organization as the SDK, i.e. the headers should +# be in `/usr/include/c++/v1` and the dylibs (or TBDs) should be in +# `/usr/lib`. Note that this is only used for linking -- since this +# is a back-deployment testing configuration, a different root for actually +# running the tests can be specified with RUNTIME_ROOT. +SDK_ROOT = lit_config.params['sdk-root'] + +# The simulated root of the system when running tests. +# +# This should be a directory hierarchy under which the libc++ and libc++abi +# dylibs can be found. The dylibs in that hierarchy are the ones that will be +# used at runtime when running the tests. +RUNTIME_ROOT = lit_config.params['runtime-root'] + +# The target triple to build tests with. +# +# The platform version in that triple should not be more recent than the +# version of the dylibs used to run against, otherwise failures are unavoidable +# since the test suite might test features that are not supported by the runtime. +TARGET_TRIPLE = lit_config.params['target-triple'] + +# TODO +EXEC_ROOT = lit_config.params['exec-root'] + +# +# Configure basic properties of the test suite +# +config.name = 'libcxx-apple-backdeployment' +config.test_source_root = os.path.join(libcxxRoot, 'test') +config.test_format = libcxx.test.newformat.CxxStandardLibraryTest() +config.recursiveExpansionLimit = 10 +config.test_exec_root = EXEC_ROOT + +# +# Configure basic substitutions +# +runPy = os.path.join(libcxxRoot, 'utils', 'run.py') +config.substitutions.append(('%{cxx}', 'xcrun --sdk {} clang++'.format(SDK))) +config.substitutions.append(('%{flags}', '')) +config.substitutions.append(('%{compile_flags}', '-nostdinc++ -isystem {}'.format(os.path.join(SDK_ROOT, 'usr', 'include', 'c++', 'v1')))) +config.substitutions.append(('%{link_flags}', '-nostdlib++ -L {} -lc++ -Wl,-rpath,{}'.format(os.path.join(SDK_ROOT, 'usr', 'lib'), RUNTIME_ROOT))) +config.substitutions.append(('%{exec}', '{} {} --execdir %t.execdir -- '.format(pipes.quote(sys.executable), pipes.quote(runPy)))) + +# Non-basic substitutions +config.substitutions.append(('%{libcxx_src_root}', libcxxRoot)) + +# +# Add Lit features specific to back-deployment +# +(arch, vendor, deploymentTarget) = TARGET_TRIPLE.split('-') +config.available_features.add('with_system_cxx_lib={}'.format(deploymentTarget.strip('.0123456789'))) +config.available_features.add('with_system_cxx_lib={}'.format(deploymentTarget)) +config.available_features.add('availability={}'.format(deploymentTarget)) + +# Dylib support for shared_mutex was added in macosx10.12. +if deploymentTarget in ('macosx10.%s' % v for v in range(9, 12)): + config.available_features.add('dylib-has-no-shared_mutex') + +# Throwing bad_optional_access, bad_variant_access and bad_any_cast is +# supported starting in macosx10.14. +if deploymentTarget in ('macosx10.%s' % v for v in range(9, 14)): + config.available_features.add('dylib-has-no-bad_optional_access') + config.available_features.add('dylib-has-no-bad_variant_access') + config.available_features.add('dylib-has-no-bad_any_cast') + +# Filesystem is support on Apple platforms starting with macosx10.15. +if deploymentTarget in ('macosx10.%s' % v for v in range(9, 15)): + config.available_features.add('c++filesystem-disabled') + +# +# Configure parameters of the test suite +# +supportedParams = [p for p in libcxx.test.params.parameters if p.name in ('std', 'exceptions', 'rtti')] +for param in supportedParams: + feature = param.getFeature(config, lit_config.params) + if feature: + feature.enableIn(config) + +# +# Configure automatically-detected features of the test suite +# +supportedFeatures = [f for f in libcxx.test.features.features if f.isSupported(config)] +for feature in supportedFeatures: + feature.enableIn(config) diff --git a/libcxx/test/configs/libcxx-trunk-shared.cfg.in b/libcxx/test/configs/libcxx-trunk-shared.cfg.in new file mode 100644 --- /dev/null +++ b/libcxx/test/configs/libcxx-trunk-shared.cfg.in @@ -0,0 +1,54 @@ +@AUTO_GEN_COMMENT@ + +# TODO +LIBCXX_ROOT = "@LLVM_SOURCE_DIR@/../libcxx" +INSTALL_ROOT = "@CMAKE_INSTALL_PREFIX@" +COMPILER = "@CMAKE_CXX_COMPILER@" +EXEC_ROOT = "@PROJECT_BINARY_DIR@" + +import os +import pipes +import site +import sys +site.addsitedir(os.path.join(LIBCXX_ROOT, 'utils')) +import libcxx.test.features +import libcxx.test.newformat +import libcxx.test.params + +# +# Configure basic properties of the test suite +# +config.name = 'libcxx-trunk-shared' +config.test_source_root = os.path.join(LIBCXX_ROOT, 'test') +config.test_format = libcxx.test.newformat.CxxStandardLibraryTest() +config.recursiveExpansionLimit = 10 +config.test_exec_root = EXEC_ROOT + +# +# Configure basic substitutions +# +runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py') +config.substitutions.append(('%{cxx}', COMPILER)) +config.substitutions.append(('%{flags}', '')) +config.substitutions.append(('%{compile_flags}', '-nostdinc++ -isystem {} -I {}'.format(os.path.join(INSTALL_ROOT, 'include', 'c++', 'v1'), + os.path.join(LIBCXX_ROOT, 'test', 'support')))) +config.substitutions.append(('%{link_flags}', '-nostdlib++ -L {0} -lc++ -Wl,-rpath,{0}'.format(os.path.join(INSTALL_ROOT, 'lib')))) +config.substitutions.append(('%{exec}', '{} {} --execdir %T -- '.format(pipes.quote(sys.executable), pipes.quote(runPy)))) + +# Non-basic substitutions +config.substitutions.append(('%{libcxx_src_root}', LIBCXX_ROOT)) + +# +# Configure parameters of the test suite +# +for param in libcxx.test.params.parameters: + feature = param.getFeature(config, lit_config.params) + if feature: + feature.enableIn(config) + +# +# Configure automatically-detected features of the test suite +# +supportedFeatures = [f for f in libcxx.test.features.features if f.isSupported(config)] +for feature in supportedFeatures: + feature.enableIn(config) diff --git a/libcxx/test/configs/libcxx-trunk-static.cfg.in b/libcxx/test/configs/libcxx-trunk-static.cfg.in new file mode 100644 --- /dev/null +++ b/libcxx/test/configs/libcxx-trunk-static.cfg.in @@ -0,0 +1,53 @@ +import os +import pipes +import site +import sys +libcxxRoot = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) +site.addsitedir(os.path.join(libcxxRoot, 'utils')) +import libcxx.test.features +import libcxx.test.newformat +import libcxx.test.params + +# TODO +INSTALL_ROOT = lit_config.params['install-root'] +EXEC_ROOT = lit_config.params['exec-root'] +COMPILER = lit_config.params['compiler'] + +# +# Configure basic properties of the test suite +# +config.name = 'libcxx-trunk-static' +config.test_source_root = os.path.join(libcxxRoot, 'test') +config.test_format = libcxx.test.newformat.CxxStandardLibraryTest() +config.recursiveExpansionLimit = 10 +config.test_exec_root = EXEC_ROOT + +# +# Configure basic substitutions +# +runPy = os.path.join(libcxxRoot, 'utils', 'run.py') +config.substitutions.append(('%{cxx}', COMPILER)) +config.substitutions.append(('%{flags}', '')) +config.substitutions.append(('%{compile_flags}', '-nostdinc++ -isystem {} -I {}'.format(os.path.join(INSTALL_ROOT, 'include', 'c++', 'v1'), + os.path.join(libcxxRoot, 'test', 'support')))) +config.substitutions.append(('%{link_flags}', '-nostdlib++ {} {}'.format(os.path.join(INSTALL_ROOT, 'lib', 'libc++.a'), + os.path.join(INSTALL_ROOT, 'lib', 'libc++abi.a')))) +config.substitutions.append(('%{exec}', '{} {} --execdir %t.execdir -- '.format(pipes.quote(sys.executable), pipes.quote(runPy)))) + +# Non-basic substitutions +config.substitutions.append(('%{libcxx_src_root}', libcxxRoot)) + +# +# Configure parameters of the test suite +# +for param in libcxx.test.params.parameters: + feature = param.getFeature(config, lit_config.params) + if feature: + feature.enableIn(config) + +# +# Configure automatically-detected features of the test suite +# +supportedFeatures = [f for f in libcxx.test.features.features if f.isSupported(config)] +for feature in supportedFeatures: + feature.enableIn(config)