summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore54
-rw-r--r--CMakeLists.txt21
-rw-r--r--test/libcxxabi/test/config.py28
-rw-r--r--test/lit.cfg53
-rw-r--r--test/lit.site.cfg.in1
-rw-r--r--www/index.html5
6 files changed, 114 insertions, 48 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b26d5f7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,54 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+#lib/ # We actually have things checked in to lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.cache
+nosetests.xml
+coverage.xml
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6be1e15..8402480 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,6 +97,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LIBCXXABI_BUILT_STANDALONE 1)
else()
+ set(LLVM_MAIN_SRC_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Path to LLVM source tree")
set(LLVM_LIT "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
set(LIBCXXABI_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
endif()
@@ -126,14 +127,32 @@ find_path(
LIBCXXABI_LIBCXX_INCLUDES
vector
PATHS ${LIBCXXABI_LIBCXX_INCLUDES}
+ ${LIBCXXABI_LIBCXX_PATH}/include
${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES}
${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
${LLVM_INCLUDE_DIR}/c++/v1
)
-set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE STRING
+set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE PATH
"Specify path to libc++ includes." FORCE)
+find_path(
+ LIBCXXABI_LIBCXX_PATH
+ test/libcxx/__init__.py
+ PATHS ${LIBCXXABI_LIBCXX_PATH}
+ ${LIBCXXABI_LIBCXX_INCLUDES}/../
+ ${LLVM_MAIN_SRC_DIR}/projects/libcxx/
+ NO_DEFAULT_PATH
+ )
+
+if (LIBCXXABI_LIBCXX_PATH STREQUAL "LIBCXXABI_LIBCXX_PATH-NOTFOUND")
+ message(WARNING "LIBCXXABI_LIBCXX_PATH was not specified and couldn't be infered.")
+ set(LIBCXXABI_LIBCXX_PATH "")
+endif()
+
+set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH
+ "Specify path to libc++ source." FORCE)
+
#===============================================================================
# Configure System
#===============================================================================
diff --git a/test/libcxxabi/test/config.py b/test/libcxxabi/test/config.py
index a5042d0..52cdcbd 100644
--- a/test/libcxxabi/test/config.py
+++ b/test/libcxxabi/test/config.py
@@ -1,26 +1,23 @@
-import locale
import os
-import platform
-import re
-import shlex
import sys
-import lit.Test # pylint: disable=import-error,no-name-in-module
-import lit.util # pylint: disable=import-error,no-name-in-module
-
-from libcxx.test.format import LibcxxTestFormat
from libcxx.test.config import Configuration as LibcxxConfiguration
-from libcxx.compiler import CXXCompiler
+
class Configuration(LibcxxConfiguration):
# pylint: disable=redefined-outer-name
def __init__(self, lit_config, config):
super(Configuration, self).__init__(lit_config, config)
+ self.libcxxabi_src_root = None
+ self.libcxx_src_root = None
+ self.obj_root = None
def configure_src_root(self):
- self.libcxxabi_src_root = self.get_lit_conf('libcxxabi_src_root',
+ self.libcxxabi_src_root = self.get_lit_conf(
+ 'libcxxabi_src_root',
os.path.dirname(self.config.test_source_root))
- self.libcxx_src_root = self.get_lit_conf('libcxx_src_root',
+ self.libcxx_src_root = self.get_lit_conf(
+ 'libcxx_src_root',
os.path.join(self.libcxxabi_src_root, '/../libcxx'))
def configure_obj_root(self):
@@ -32,16 +29,17 @@ class Configuration(LibcxxConfiguration):
super(Configuration, self).configure_compile_flags()
def configure_compile_flags_header_includes(self):
- cxx_headers = self.get_lit_conf('cxx_headers',
+ cxx_headers = self.get_lit_conf(
+ '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]
- libcxxabi_headers = self.get_lit_conf('libcxxabi_headers',
- os.path.join(self.libcxxabi_src_root,
- 'include'))
+ libcxxabi_headers = self.get_lit_conf(
+ 'libcxxabi_headers',
+ os.path.join(self.libcxxabi_src_root, 'include'))
if not os.path.isdir(libcxxabi_headers):
self.lit_config.fatal("libcxxabi_headers='%s' is not a directory."
% libcxxabi_headers)
diff --git a/test/lit.cfg b/test/lit.cfg
index b07e6e1..f0334eb 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -26,42 +26,32 @@ config.test_source_root = os.path.dirname(__file__)
# Infer the libcxx_test_source_root for configuration import.
# If libcxx_source_root isn't specified in the config, assume that the libcxx
# and libcxxabi source directories are sibling directories.
-libcxx_source_root = getattr(config, 'libcxx_source_root',
- os.path.join(config.test_source_root,
- '../../libcxx'))
-libcxx_test_source_root = os.path.join(libcxx_source_root, 'test')
-if os.path.isdir(libcxx_test_source_root):
- sys.path.insert(0, libcxx_test_source_root)
+libcxx_src_root = getattr(config, 'libcxx_src_root', None)
+if not libcxx_src_root:
+ libcxx_src_root = os.path.join(config.test_source_root, '../../libcxx')
+libcxx_test_src_root = os.path.join(libcxx_src_root, 'test')
+if os.path.isfile(os.path.join(libcxx_test_src_root, 'libcxx', '__init__.py')):
+ site.addsitedir(libcxx_test_src_root)
else:
lit_config.fatal('Could not find libcxx test directory for test imports'
- ' in: %s' % libcxx_test_source_root)
+ ' in: %s' % libcxx_test_src_root)
-# Infer the test_exec_root from the libcxxabi_object root.
-libcxxabi_obj_root = getattr(config, 'libcxxabi_obj_root', None)
-if libcxxabi_obj_root is not None:
- config.test_exec_root = os.path.join(libcxxabi_obj_root, 'test')
+# 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 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('libcxxabi_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()
+if obj_root is None:
+ import libcxx.test.config
+ libcxx.test.config.loadSiteConfig(
+ lit_config, config, 'libcxxabi_site_config', 'LIBCXXABI_SITE_CONFIG')
+ obj_root = getattr(config, 'libcxxabi_obj_root', None)
+ if obj_root is None:
+ import tempfile
+ obj_root = tempfile.mkdtemp(prefix='libcxxabi-testsuite-')
+ lit_config.warning('Creating temporary directory for object root: %s' %
+ obj_root)
+
+config.test_exec_root = os.path.join(obj_root, 'test')
cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi')
if cfg_variant:
@@ -73,4 +63,5 @@ config_module = __import__(config_module_name, fromlist=['Configuration'])
configuration = config_module.Configuration(lit_config, config)
configuration.configure()
+configuration.print_config_info()
config.test_format = configuration.get_test_format()
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 81f25af..62dcf0a 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -2,6 +2,7 @@
config.cxx_under_test = "@LIBCXXABI_COMPILER@"
config.libcxxabi_src_root = "@LIBCXXABI_SOURCE_DIR@"
config.libcxxabi_obj_root = "@LIBCXXABI_LIBRARY_DIR@"
+config.libcxx_src_root = "@LIBCXXABI_LIBCXX_PATH@"
config.cxx_headers = "@LIBCXXABI_LIBCXX_INCLUDES@"
config.llvm_unwinder = "@LIBCXXABI_USE_LLVM_UNWINDER@"
config.enable_threads = "@LIBCXXABI_ENABLE_THREADS@"
diff --git a/www/index.html b/www/index.html
index b7b66d8..cc34014 100644
--- a/www/index.html
+++ b/www/index.html
@@ -90,9 +90,12 @@
<p>To do a standalone build:</p>
<ul>
+ <li>
+ Check out the <a href="http://libcxx.llvm.org">libcxx source</a> tree.
+ </li>
<li><code>cd libcxxabi</code></li>
<li><code>mkdir build &amp;&amp; cd build</code></li>
- <li><code>cmake -DLIBCXXABI_LIBCXX_INCLUDES=path/to/libcxx/include .. # on
+ <li><code>cmake -DLIBCXXABI_LIBCXX_PATH=path/to/libcxx .. # on
linux you may need -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++</code></li>
<li><code>make</code></li>
</ul>