diff options
Diffstat (limited to 'libcxx/test')
-rw-r--r-- | libcxx/test/libcxx/test/config.py | 57 | ||||
-rw-r--r-- | libcxx/test/lit.cfg | 10 |
2 files changed, 51 insertions, 16 deletions
diff --git a/libcxx/test/libcxx/test/config.py b/libcxx/test/libcxx/test/config.py index b05029d969a..f283f25b305 100644 --- a/libcxx/test/libcxx/test/config.py +++ b/libcxx/test/libcxx/test/config.py @@ -57,6 +57,7 @@ class Configuration(object): self.lit_config = lit_config self.config = config self.cxx = None + self.cxx_stdlib_under_test = None self.project_obj_root = None self.libcxx_src_root = None self.libcxx_obj_root = None @@ -96,6 +97,7 @@ class Configuration(object): self.configure_triple() self.configure_src_root() self.configure_obj_root() + self.configure_cxx_stdlib_under_test() self.configure_cxx_library_root() self.configure_use_system_cxx_lib() self.configure_use_clang_verify() @@ -215,6 +217,15 @@ class Configuration(object): self.lit_config.note( "inferred use_system_cxx_lib as: %r" % self.use_system_cxx_lib) + def configure_cxx_stdlib_under_test(self): + self.cxx_stdlib_under_test = self.get_lit_conf( + 'cxx_stdlib_under_test', 'libc++') + if self.cxx_stdlib_under_test not in \ + ['libc++', 'libstdc++', 'cxx_default']: + self.lit_config.fatal( + 'unsupported value for "cxx_stdlib_under_test": %s' + % self.cxx_stdlib_under_test) + def configure_use_clang_verify(self): '''If set, run clang with -verify on failing tests.''' self.use_clang_verify = self.get_lit_bool('use_clang_verify') @@ -329,7 +340,6 @@ class Configuration(object): self.cxx.compile_flags += ['-std={0}'.format(std)] self.config.available_features.add(std) # Configure include paths - self.cxx.compile_flags += ['-nostdinc++'] self.configure_compile_flags_header_includes() self.target_info.add_cxx_compile_flags(self.cxx.compile_flags) # Configure feature flags. @@ -352,14 +362,22 @@ class Configuration(object): def configure_compile_flags_header_includes(self): support_path = os.path.join(self.libcxx_src_root, 'test/support') - self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')] + if self.cxx_stdlib_under_test != 'libstdc++': + self.cxx.compile_flags += [ + '-include', os.path.join(support_path, 'nasty_macros.hpp')] self.configure_config_site_header() - libcxx_headers = self.get_lit_conf( - 'libcxx_headers', os.path.join(self.libcxx_src_root, 'include')) - if not os.path.isdir(libcxx_headers): - self.lit_config.fatal("libcxx_headers='%s' is not a directory." - % libcxx_headers) - self.cxx.compile_flags += ['-I' + libcxx_headers] + cxx_headers = self.get_lit_conf('cxx_headers') + if cxx_headers == '' or (cxx_headers is None + and self.cxx_stdlib_under_test != 'libc++'): + self.lit_config.note('using the system cxx headers') + return + self.cxx.compile_flags += ['-nostdinc++'] + if cxx_headers is None: + cxx_headers = os.path.join(self.libcxx_src_root, 'include') + if not os.path.isdir(cxx_headers): + self.lit_config.fatal("cxx_headers='%s' is not a directory." + % cxx_headers) + self.cxx.compile_flags += ['-I' + cxx_headers] def configure_config_site_header(self): # Check for a possible __config_site in the build directory. We @@ -468,16 +486,29 @@ class Configuration(object): def configure_link_flags(self): no_default_flags = self.get_lit_bool('no_default_flags', False) if not no_default_flags: - self.cxx.link_flags += ['-nodefaultlibs'] - # Configure library path self.configure_link_flags_cxx_library_path() self.configure_link_flags_abi_library_path() # Configure libraries - self.configure_link_flags_cxx_library() - self.configure_link_flags_abi_library() - self.configure_extra_library_flags() + if self.cxx_stdlib_under_test == 'libc++': + self.cxx.link_flags += ['-nodefaultlibs'] + self.configure_link_flags_cxx_library() + self.configure_link_flags_abi_library() + self.configure_extra_library_flags() + elif self.cxx_stdlib_under_test == 'libstdc++': + enable_fs = self.get_lit_bool('enable_filesystem', + default=False) + if enable_fs: + self.config.available_features.add('c++experimental') + self.cxx.link_flags += ['-lstdc++fs'] + self.cxx.link_flags += ['-lm', '-pthread'] + elif self.cxx_stdlib_under_test == 'cxx_default': + self.cxx.link_flags += ['-pthread'] + else: + self.lit_config.fatal( + 'unsupported value for "use_stdlib_type": %s' + % use_stdlib_type) link_flags_str = self.get_lit_conf('link_flags', '') self.cxx.link_flags += shlex.split(link_flags_str) diff --git a/libcxx/test/lit.cfg b/libcxx/test/lit.cfg index f7fa6144f08..af41f6cead0 100644 --- a/libcxx/test/lit.cfg +++ b/libcxx/test/lit.cfg @@ -20,20 +20,24 @@ config.suffixes = ['.pass.cpp', '.fail.cpp', '.sh.cpp'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) +loaded_site_cfg = getattr(config, 'loaded_site_config', False) +if not loaded_site_cfg: + import libcxx.test.config + libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config', + 'LIBCXX_SITE_CONFIG') + # Infer the test_exec_root from the libcxx_object root. obj_root = getattr(config, 'libcxx_obj_root', None) # Check that the test exec root is known. if obj_root is None: - import libcxx.test.config - libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config', - 'LIBCXX_SITE_CONFIG') obj_root = getattr(config, 'libcxx_obj_root', None) if obj_root is None: import tempfile obj_root = tempfile.mkdtemp(prefix='libcxx-testsuite-') lit_config.warning('Creating temporary directory for object root: %s' % obj_root) + config.libcxx_obj_root = obj_root config.test_exec_root = os.path.join(obj_root, 'test') |