Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -91,6 +91,11 @@ 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. Index: test/CMakeLists.txt =================================================================== --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -23,10 +23,6 @@ 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) Index: test/lit.cfg =================================================================== --- test/lit.cfg +++ test/lit.cfg @@ -185,6 +185,7 @@ 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'] @@ -219,6 +220,7 @@ 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_env() @@ -304,6 +306,9 @@ 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 @@ -457,8 +462,8 @@ # 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] @@ -573,7 +578,7 @@ 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++' @@ -584,6 +589,32 @@ # 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.') + 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 Index: test/lit.site.cfg.in =================================================================== --- test/lit.site.cfg.in +++ test/lit.site.cfg.in @@ -3,7 +3,7 @@ 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@" Index: www/index.html =================================================================== --- www/index.html +++ www/index.html @@ -216,8 +216,9 @@