2010-12-11 03:47:54 +08:00
|
|
|
macro(pythonize_bool var)
|
|
|
|
if (${var})
|
|
|
|
set(${var} True)
|
|
|
|
else()
|
|
|
|
set(${var} False)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2015-02-04 02:47:37 +08:00
|
|
|
set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's llvm-lit.")
|
|
|
|
|
|
|
|
if(LIBCXX_BUILT_STANDALONE)
|
|
|
|
# Make sure we can use the console pool for recent cmake and ninja > 1.5
|
|
|
|
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
|
|
|
|
set(cmake_3_2_USES_TERMINAL)
|
2013-10-04 05:58:25 +08:00
|
|
|
else()
|
2015-02-04 02:47:37 +08:00
|
|
|
set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
|
2013-10-04 05:58:25 +08:00
|
|
|
endif()
|
2015-02-04 02:47:37 +08:00
|
|
|
else()
|
|
|
|
include(FindPythonInterp)
|
|
|
|
if(PYTHONINTERP_FOUND)
|
|
|
|
set(LIT_EXECUTABLE
|
|
|
|
${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/utils/lit/lit.py)
|
|
|
|
else()
|
|
|
|
message(WARNING "Could not find Python, cannot set LIT_EXECUTABLE.")
|
|
|
|
endif()
|
|
|
|
endif()
|
2013-10-04 05:58:25 +08:00
|
|
|
|
2015-02-04 02:47:37 +08:00
|
|
|
if (LIT_EXECUTABLE)
|
2014-08-23 12:33:20 +08:00
|
|
|
set(LIT_ARGS_DEFAULT "-sv --show-unsupported --show-xfail")
|
2010-12-11 03:47:54 +08:00
|
|
|
if (MSVC OR XCODE)
|
|
|
|
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
|
|
|
|
endif()
|
|
|
|
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}"
|
|
|
|
CACHE STRING "Default options for lit")
|
|
|
|
set(LIT_ARGS "${LLVM_LIT_ARGS}")
|
|
|
|
separate_arguments(LIT_ARGS)
|
|
|
|
|
2015-01-16 02:56:45 +08:00
|
|
|
set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
|
|
|
|
"Configuration variant to use for LIT.")
|
2015-01-16 02:35:04 +08:00
|
|
|
|
2014-12-12 10:36:23 +08:00
|
|
|
pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
|
|
|
|
pythonize_bool(LIBCXX_ENABLE_RTTI)
|
2010-12-11 03:47:54 +08:00
|
|
|
pythonize_bool(LIBCXX_ENABLE_SHARED)
|
2014-12-12 11:12:18 +08:00
|
|
|
pythonize_bool(LIBCXX_BUILD_32_BITS)
|
Add option to disable access to the global filesystem namespace.
Systems like FreeBSD's Capsicum and Nuxi CloudABI apply the concept of
capability-based security on the way processes can interact with the
filesystem API. It is no longer possible to interact with the VFS
through calls like open(), unlink(), rename(), etc. Instead, processes
are only allowed to interact with files and directories to which they
have been granted access. The *at() functions can be used for this
purpose.
This change adds a new config switch called
_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE. If set, all functionality
that requires the global filesystem namespace will be disabled. More
concretely:
- fstream's open() function will be removed.
- cstdio will no longer pull in fopen(), rename(), etc.
- The test suite's get_temp_file_name() will be removed. This will cause
all tests that use the global filesystem namespace to break, but will
at least make all the other tests run (as get_temp_file_name will not
build anyway).
It is important to mention that this change will make fstream rather
useless on those systems for now. Still, I'd rather not have fstream
disabled entirely, as it is of course possible to come up with an
extension for fstream that would allow access to local filesystem
namespaces (e.g., by adding an openat() member function).
Differential revision: http://reviews.llvm.org/D8194
Reviewed by: jroelofs (thanks!)
llvm-svn: 232049
2015-03-12 23:44:39 +08:00
|
|
|
pythonize_bool(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE)
|
2015-03-26 22:35:46 +08:00
|
|
|
pythonize_bool(LIBCXX_ENABLE_STDIN)
|
|
|
|
pythonize_bool(LIBCXX_ENABLE_STDOUT)
|
2014-12-07 05:02:58 +08:00
|
|
|
pythonize_bool(LIBCXX_ENABLE_THREADS)
|
|
|
|
pythonize_bool(LIBCXX_ENABLE_MONOTONIC_CLOCK)
|
2015-03-31 12:15:45 +08:00
|
|
|
pythonize_bool(LIBCXX_GENERATE_COVERAGE)
|
|
|
|
|
2015-03-03 23:59:51 +08:00
|
|
|
# The tests shouldn't link to any ABI library when it has been linked into
|
|
|
|
# libc++ statically.
|
|
|
|
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
|
|
|
set(LIBCXX_CXX_ABI_LIBNAME "none")
|
|
|
|
endif()
|
2015-02-13 23:25:21 +08:00
|
|
|
set(LIBCXX_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
|
|
|
|
"TargetInfo to use when setting up test environment.")
|
Add remote testing support to the lit config.
Executors can be specified at configure time by using the -DLIBCXX_EXECUTOR=""
option. Examples include:
$ cmake <other_flags> -DLIBCXX_EXECUTOR="TimeoutExecutor(30,LocalExecutor())"
This runs individual tests with a maximum duration
$ cmake <other_flags> -DLIBCXX_EXECUTOR="SSHExecutor('hostname','username')"
This runs tests on a remote target, using scp to shuttle binaries to the
target, and ssh to invoke commands there.
$ cmake <other_flags> -DLIBCXX_EXECUTOR="PrefixExecutor('/path/to/run/script',LocalExecutor())"
This assumes the script knows how to copy run the executables passed to it,
and allows for the ultimate control. This is useful for running things
inside emulators like Valgrind & QEMU.
TODO: This doesn't claim to support ShTest tests yet, that will take a bit more
thought & finagling (I'm still not sure how to orchestrate copy-in for those cases.
I've also punted on what to do about tests that read data files. The testsuite
has several tests that need to read *.dat files placed next to them, and
currently those aren't copied over when using, say, an SSHExecutor. The
affected tests are:
libc++ :: std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
libc++ :: std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
libc++ :: std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
libc++ :: std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
Note: One thing to watch out for when using the SSHExecutor for cross-testing is
that you'll also want to specify a TargetInfo object (so that the host's
features aren't used for available-features checks and flags setup).
http://reviews.llvm.org/D7380
llvm-svn: 230592
2015-02-26 08:42:17 +08:00
|
|
|
set(LIBCXX_EXECUTOR "None" CACHE STRING
|
|
|
|
"Executor to use when running tests.")
|
2010-12-11 03:47:54 +08:00
|
|
|
|
|
|
|
set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
@ONLY)
|
|
|
|
|
2012-03-19 23:40:23 +08:00
|
|
|
add_custom_target(check-libcxx
|
2015-02-04 02:47:37 +08:00
|
|
|
COMMAND ${LIT_EXECUTABLE}
|
2010-12-11 03:47:54 +08:00
|
|
|
${LIT_ARGS}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2013-10-04 05:58:25 +08:00
|
|
|
DEPENDS cxx
|
2015-01-23 14:59:51 +08:00
|
|
|
COMMENT "Running libcxx tests"
|
|
|
|
${cmake_3_2_USES_TERMINAL})
|
2015-03-31 12:15:45 +08:00
|
|
|
|
|
|
|
if (LIBCXX_GENERATE_COVERAGE)
|
|
|
|
include(CodeCoverage)
|
|
|
|
set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage")
|
|
|
|
set(capture_dirs "${LIBCXX_LIB_CMAKEFILES_DIR}/cxx.dir/;${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
set(extract_dirs "${LIBCXX_SOURCE_DIR}/include;${LIBCXX_SOURCE_DIR}/src")
|
|
|
|
setup_lcov_test_target_coverage("cxx" "${output_dir}" "${capture_dirs}" "${extract_dirs}")
|
|
|
|
endif()
|
2010-12-11 03:47:54 +08:00
|
|
|
else()
|
2015-02-04 02:47:37 +08:00
|
|
|
message(WARNING
|
|
|
|
"LIT_EXECUTABLE not set, no check-libcxx target will be available!")
|
2010-12-11 03:47:54 +08:00
|
|
|
endif()
|