diff options
author | Andrea Mattavelli <andreamattavelli@users.noreply.github.com> | 2017-01-18 16:54:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-18 16:54:26 +0000 |
commit | de7e2b94a5f9ee05496e6a65e7370d7270b38799 (patch) | |
tree | 6478c01fc41cc806e27ba7c5d9688bc2f45cbffa | |
parent | b149dfa242753004d8fb00c4aa55e340d56c0d43 (diff) | |
parent | 19b7bdd916c484b52ce1237401b15a346575b4cf (diff) | |
download | klee-de7e2b94a5f9ee05496e6a65e7370d7270b38799.tar.gz |
Merge pull request #569 from delcypher/cmake_remove_enable_tests_option
[CMake] Remove `ENABLE_TESTS` CMake cache option.
-rwxr-xr-x | .travis/klee.sh | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 54 | ||||
-rw-r--r-- | README-CMake.md | 2 |
3 files changed, 35 insertions, 24 deletions
diff --git a/.travis/klee.sh b/.travis/klee.sh index 09fb175a..8db724ac 100755 --- a/.travis/klee.sh +++ b/.travis/klee.sh @@ -144,7 +144,8 @@ if [ "X${USE_CMAKE}" == "X1" ]; then -DGTEST_SRC_DIR=${GTEST_SRC_DIR} \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ ${KLEE_ASSERTS_OPTION} \ - -DENABLE_TESTS=TRUE \ + -DENABLE_UNIT_TESTS=TRUE \ + -DENABLE_SYSTEM_TESTS=TRUE \ -DLIT_ARGS="-v" \ ${KLEE_SRC} make diff --git a/CMakeLists.txt b/CMakeLists.txt index 80224283..97c51a2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -672,9 +672,22 @@ add_subdirectory(tools) ################################################################################ # Testing ################################################################################ -option(ENABLE_TESTS "Enable tests" ON) +option(ENABLE_UNIT_TESTS "Enable unit tests" ON) +option(ENABLE_SYSTEM_TESTS "Enable system tests" ON) + +# This provides a migration path for older build directories that have this +# variable set in their cache. Leaving it behind could lead to confusion so +# removing it is probably a good idea. +# TODO: Remove this eventually (probably next release or something). +if (DEFINED ENABLE_TESTS) + message(WARNING "You have the \"ENABLE_TESTS\" variable is your CMake cache." + "This variable no longer has any meaning so removing it from your cache") + unset(ENABLE_TESTS CACHE) +endif() + +if (ENABLE_UNIT_TESTS OR ENABLE_SYSTEM_TESTS) + message(STATUS "Testing is enabled") -if (ENABLE_TESTS) # Find lit set(LIT_TOOL_NAMES "llvm-lit" "lit") find_program( @@ -691,11 +704,12 @@ if (ENABLE_TESTS) "Lit arguments" ) -if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}")) + if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}")) message(FATAL_ERROR "The lit tool is required for testing." " CMake tried to find lit with the following names \"${LIT_TOOL_NAMES}\"" " but it could not be found.\n" - "You should either disable testing by passing \"-DENABLE_TESTS=OFF\" to cmake" + "You should either disable testing by passing " + "\"-DENABLE_UNIT_TESTS=OFF -DENABLE_SYSTEM_TESTS=OFF\" to cmake" " or you should install the lit tool from the Python Package Index by running" " \"pip install lit\". Note \"pip\" requires root privileges to run. If you" " don't have root privileges you can create a virtual python environment using" @@ -708,26 +722,24 @@ if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}")) add_custom_target(check COMMENT "Running tests" ) +else() + message(STATUS "Testing is disabled") +endif() - option(ENABLE_UNIT_TESTS "Enable unit tests" ON) - if (ENABLE_UNIT_TESTS) - message(STATUS "Unit tests enabled") - add_subdirectory(unittests) - add_dependencies(check unittests) - else() - message(STATUS "Unit tests disabled") - endif() - option(ENABLE_SYSTEM_TESTS "Enable system tests" ON) - if (ENABLE_SYSTEM_TESTS) - message(STATUS "System tests enabled") - add_subdirectory(test) - add_dependencies(check systemtests) - else() - message(STATUS "System tests disabled") - endif() +if (ENABLE_UNIT_TESTS) + message(STATUS "Unit tests enabled") + add_subdirectory(unittests) + add_dependencies(check unittests) +else() + message(STATUS "Unit tests disabled") +endif() +if (ENABLE_SYSTEM_TESTS) + message(STATUS "System tests enabled") + add_subdirectory(test) + add_dependencies(check systemtests) else() - message(STATUS "Testing disabled") + message(STATUS "System tests disabled") endif() ################################################################################ diff --git a/README-CMake.md b/README-CMake.md index 896ddda6..c2893004 100644 --- a/README-CMake.md +++ b/README-CMake.md @@ -52,8 +52,6 @@ cmake -DCMAKE_BUILD_TYPE=Release /path/to/klee/src * `ENABLE_TCMALLOC` (BOOLEAN) - Enable TCMalloc support. -* `ENABLE_TESTS` (BOOLEAN) - Enable testing. - * `ENABLE_UNIT_TESTS` (BOOLEAN) - Enable KLEE unit tests. * `GTEST_SRC_DIR` (STRING) - Path to GTest source tree. |