b33ae5ba7d
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!) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232049 91177308-0d34-0410-b5e6-96231b3b80d8
76 lines
2.3 KiB
CMake
76 lines
2.3 KiB
CMake
macro(pythonize_bool var)
|
|
if (${var})
|
|
set(${var} True)
|
|
else()
|
|
set(${var} False)
|
|
endif()
|
|
endmacro()
|
|
|
|
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)
|
|
else()
|
|
set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
|
|
endif()
|
|
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()
|
|
|
|
if (LIT_EXECUTABLE)
|
|
set(LIT_ARGS_DEFAULT "-sv --show-unsupported --show-xfail")
|
|
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)
|
|
|
|
set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
|
|
"Configuration variant to use for LIT.")
|
|
|
|
pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
|
|
pythonize_bool(LIBCXX_ENABLE_RTTI)
|
|
pythonize_bool(LIBCXX_ENABLE_SHARED)
|
|
pythonize_bool(LIBCXX_BUILD_32_BITS)
|
|
pythonize_bool(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE)
|
|
pythonize_bool(LIBCXX_ENABLE_THREADS)
|
|
pythonize_bool(LIBCXX_ENABLE_MONOTONIC_CLOCK)
|
|
# 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()
|
|
set(LIBCXX_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
|
|
"TargetInfo to use when setting up test environment.")
|
|
set(LIBCXX_EXECUTOR "None" CACHE STRING
|
|
"Executor to use when running tests.")
|
|
|
|
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)
|
|
|
|
add_custom_target(check-libcxx
|
|
COMMAND ${LIT_EXECUTABLE}
|
|
${LIT_ARGS}
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
DEPENDS cxx
|
|
COMMENT "Running libcxx tests"
|
|
${cmake_3_2_USES_TERMINAL})
|
|
else()
|
|
message(WARNING
|
|
"LIT_EXECUTABLE not set, no check-libcxx target will be available!")
|
|
endif()
|