diff --git a/CMakeLists.txt b/CMakeLists.txt index 58abdf8a..69950119 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,11 @@ get_target_triple(LIBCXX_TARGET_TRIPLE set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.") +set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER}) +set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib) + # Declare libc++ configuration variables. # They are intended for use as follows: # LIBCXX_CXX_FLAGS: General flags for both the compiler and linker. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fe82dee0..e72cfbe1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,10 +23,6 @@ if(PYTHONINTERP_FOUND) set(LIT_ARGS "${LLVM_LIT_ARGS}") separate_arguments(LIT_ARGS) - set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER}) - set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) - set(LIBCXX_BINARY_DIR ${CMAKE_BINARY_DIR}) - set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE}) pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS) pythonize_bool(LIBCXX_ENABLE_RTTI) pythonize_bool(LIBCXX_ENABLE_SHARED) diff --git a/test/lit.cfg b/test/lit.cfg index 4e6a7985..9df01375 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -211,6 +211,7 @@ class Configuration(object): self.cxx = None self.src_root = None self.obj_root = None + self.library_root = None self.env = {} self.compile_flags = ['-nostdinc++'] self.link_flags = ['-nodefaultlibs'] @@ -246,6 +247,7 @@ class Configuration(object): self.configure_triple() self.configure_src_root() self.configure_obj_root() + self.configure_library_root() self.configure_use_system_lib() self.configure_use_clang_verify() self.configure_ccache() @@ -333,6 +335,9 @@ class Configuration(object): def configure_obj_root(self): self.obj_root = self.get_lit_conf('libcxx_obj_root', self.src_root) + def configure_library_root(self): + self.library_root = self.get_lit_conf('libcxx_library_root', self.obj_root) + def configure_use_system_lib(self): # This test suite supports testing against either the system library or # the locally built one; the former mode is useful for testing ABI @@ -483,8 +488,8 @@ class Configuration(object): # Configure library search paths abi_library_path = self.get_lit_conf('abi_library_path', '') if not self.use_system_lib: - self.link_flags += ['-L' + self.obj_root + '/lib'] - self.link_flags += ['-Wl,-rpath,' + self.obj_root + '/lib'] + self.link_flags += ['-L' + self.library_root] + self.link_flags += ['-Wl,-rpath,' + self.library_root] if abi_library_path: self.link_flags += ['-L' + abi_library_path, '-Wl,-rpath,' + abi_library_path] @@ -599,7 +604,7 @@ class Configuration(object): def configure_env(self): if sys.platform == 'darwin' and not self.use_system_lib: - self.env['DYLD_LIBRARY_PATH'] = os.path.join(self.obj_root, 'lib') + self.env['DYLD_LIBRARY_PATH'] = self.library_root # name: The name of this test suite. config.name = 'libc++' @@ -610,6 +615,34 @@ config.suffixes = ['.cpp'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) +# Infer the test_exec_root from the libcxx_object root. +libcxx_obj_root = getattr(config, 'libcxx_obj_root', None) +if libcxx_obj_root is not None: + config.test_exec_root = os.path.join(libcxx_obj_root, 'test') + +# Check that the test exec root is known. +if config.test_exec_root is None: + # Otherwise, we haven't loaded the site specific configuration (the user is + # probably trying to run on a test file directly, and either the site + # configuration hasn't been created by the build system, or we are in an + # out-of-tree build situation). + site_cfg = lit_config.params.get('libcxx_site_config', + os.environ.get('LIBCXX_SITE_CONFIG')) + if not site_cfg: + lit_config.warning('No site specific configuration file found!' + ' Running the tests in the default configuration.') + # TODO: Set test_exec_root to a temporary directory where output files + # can be placed. This is needed for ShTest. + elif not os.path.isfile(site_cfg): + lit_config.fatal( + "Specified site configuration file does not exist: '%s'" % + site_cfg) + else: + lit_config.note('using site specific configuration at %s' % site_cfg) + lit_config.load_config(config, site_cfg) + raise SystemExit() + + cfg_variant = getattr(config, 'configuration_variant', '') if cfg_variant: print 'Using configuration variant: %s' % cfg_variant diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index f4bd8e46..af29f664 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -3,7 +3,7 @@ config.cxx_under_test = "@LIBCXX_COMPILER@" config.std = "@LIBCXX_STD_VERSION@" config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@" config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@" -config.python_executable = "@PYTHON_EXECUTABLE@" +config.libcxx_library_root = "@LIBCXX_LIBRARY_DIR@" config.enable_exceptions = "@LIBCXX_ENABLE_EXCEPTIONS@" config.enable_rtti = "@LIBCXX_ENABLE_RTTI@" config.enable_shared = "@LIBCXX_ENABLE_SHARED@" diff --git a/www/index.html b/www/index.html index 52edd482..b69f969b 100644 --- a/www/index.html +++ b/www/index.html @@ -216,8 +216,9 @@