From d7e82a2d4e0f588faebfb6e44d01e685587f6872 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sat, 17 Dec 2016 13:44:03 +0000 Subject: [CMake] Rename "integrationtests" to "systemtests". This was a proposal from #500. @andreamattavelli pointed out that the lit tests are really system tests rather than integration tests so this commit fixes the inappropriate naming that I chose. --- .travis/klee.sh | 2 +- CMakeLists.txt | 12 ++++++------ README-CMake.md | 4 ++-- test/CMakeLists.txt | 4 ++-- tools/klee-stats/CMakeLists.txt | 2 +- tools/ktest-tool/CMakeLists.txt | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.travis/klee.sh b/.travis/klee.sh index 7ecfe78a..09fb175a 100755 --- a/.travis/klee.sh +++ b/.travis/klee.sh @@ -191,7 +191,7 @@ fi # lit tests ############################################################################### if [ "X${USE_CMAKE}" == "X1" ]; then - make integrationtests + make systemtests else # Note can't use ``make check`` because llvm-lit is not available cd test diff --git a/CMakeLists.txt b/CMakeLists.txt index e860f3e2..7d392f18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -699,24 +699,24 @@ if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}")) message(STATUS "Using lit: ${LIT_TOOL}") endif() - option(ENABLE_UNIT_TESTS "Enable unittests" ON) + option(ENABLE_UNIT_TESTS "Enable unit tests" ON) if (ENABLE_UNIT_TESTS) message(STATUS "Unit tests enabled") add_subdirectory(unittests) else() message(STATUS "Unit tests disabled") endif() - option(ENABLE_INTEGRATION_TESTS "Enable integration tests" ON) - if (ENABLE_INTEGRATION_TESTS) - message(STATUS "Integration tests enabled") + option(ENABLE_SYSTEM_TESTS "Enable system tests" ON) + if (ENABLE_SYSTEM_TESTS) + message(STATUS "System tests enabled") add_subdirectory(test) else() - message(STATUS "Integration tests disabled") + message(STATUS "System tests disabled") endif() # Add global test target add_custom_target(check - DEPENDS unittests integrationtests + DEPENDS unittests systemtests COMMENT "Running tests" ) else() diff --git a/README-CMake.md b/README-CMake.md index 991694cd..896ddda6 100644 --- a/README-CMake.md +++ b/README-CMake.md @@ -10,7 +10,7 @@ its autoconf/Makefile based build system. * `docs` - Build documentation * `edit_cache` - Show cmake/ccmake/cmake-gui interface for chaning configure options. * `help` - Show list of top level targets -* `integrationtests` - Run integration tests +* `systemtests` - Run system tests * `unittests` - Build and run unittests ## Useful CMake variables @@ -36,7 +36,7 @@ cmake -DCMAKE_BUILD_TYPE=Release /path/to/klee/src * `ENABLE_DOXYGEN` (BOOLEAN) - Enable building doxygen documentation. -* `ENABLE_INTEGRATION_TESTS` (BOOLEAN) - Enable KLEE integration tests. +* `ENABLE_SYSTEM_TESTS` (BOOLEAN) - Enable KLEE system tests. * `ENABLE_KLEE_ASSERTS` (BOOLEAN) - Enable assertions when building KLEE. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0ae78faf..9f565444 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -126,10 +126,10 @@ configure_file(lit.site.cfg.in @ONLY ) -add_custom_target(integrationtests +add_custom_target(systemtests COMMAND "${LIT_TOOL}" ${LIT_ARGS} "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS klee kleaver kleeRuntest - COMMENT "Running integration tests" + COMMENT "Running system tests" ${ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG} ) diff --git a/tools/klee-stats/CMakeLists.txt b/tools/klee-stats/CMakeLists.txt index c742f430..e5f21162 100644 --- a/tools/klee-stats/CMakeLists.txt +++ b/tools/klee-stats/CMakeLists.txt @@ -9,5 +9,5 @@ install(PROGRAMS klee-stats DESTINATION bin) # Copy into the build directory's binary directory -# so integration tests can find it +# so system tests can find it configure_file(klee-stats "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/klee-stats" COPYONLY) diff --git a/tools/ktest-tool/CMakeLists.txt b/tools/ktest-tool/CMakeLists.txt index 76e31ac0..dbb00e91 100644 --- a/tools/ktest-tool/CMakeLists.txt +++ b/tools/ktest-tool/CMakeLists.txt @@ -9,5 +9,5 @@ install(PROGRAMS ktest-tool DESTINATION bin) # Copy into the build directory's binary directory -# so integration tests can find it +# so system tests can find it configure_file(ktest-tool "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ktest-tool" COPYONLY) -- cgit 1.4.1 From 4dded235b6de4254589719ce1870f6dd117095ea Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 18 Dec 2016 15:18:14 +0000 Subject: Rename old build system targets so that * lit tests are run by the `systemtests` target * The `check` target runs the `systemtests` and `unittests` target This make its target names consistent with the CMake build system. --- Makefile.rules | 15 ++++++++++----- test/Makefile | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index 20e19e26..cdc61bf8 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -21,10 +21,10 @@ #-------------------------------------------------------------------- RecursiveTargets := all clean clean-all install uninstall install-bytecode \ unitcheck -LocalTargets := all-local clean-local clean-all-local check-local \ +LocalTargets := all-local clean-local clean-all-local systemtests-local \ install-local printvars uninstall-local \ install-bytecode-local -TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \ +TopLevelTargets := check systemtests dist dist-check dist-clean dist-gzip dist-bzip2 \ dist-zip unittests UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets) InternalTargets := preconditions distdir dist-hook @@ -1855,15 +1855,20 @@ endif endif +############################################################################### +# Global target to run all tests +############################################################################### +check:: systemtests unittests + ############################################################################### # CHECK: Running the test suite ############################################################################### -check:: +systemtests:: $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \ if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \ $(EchoCmd) Running test suite ; \ - $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \ + $(MAKE) -C $(PROJ_OBJ_ROOT)/test systemtests-local \ TESTSUITE=$(TESTSUITE) ; \ else \ $(EchoCmd) No Makefile in test directory ; \ @@ -2001,7 +2006,7 @@ dist-check:: $(DistTarGZip) ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \ --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \ $(MAKE) all && \ - $(MAKE) check && \ + $(MAKE) systemtests && \ $(MAKE) unittests && \ $(MAKE) install && \ $(MAKE) uninstall && \ diff --git a/test/Makefile b/test/Makefile index ed7ba197..c9924244 100644 --- a/test/Makefile +++ b/test/Makefile @@ -13,7 +13,7 @@ DIRS = # # Make llvm-lit the default for testing # -all:: check-local +all:: systemtests-local # Include other test rules include Makefile.tests @@ -55,7 +55,7 @@ check-local:: lit.site.cfg exit 1; \ fi -check-local-all:: lit.site.cfg +systemtests-local:: lit.site.cfg $(Verb) ( $(ULIMIT) \ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) -- cgit 1.4.1 From 01ba72697bc5476bfe486725c302bb2e0867076e Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 19 Dec 2016 12:29:48 +0000 Subject: Remove undocumented and unused `check-local`, `check-dg` and `check-lit` targets from Autoconf/Makefile build system. Having these around just confuses things. --- Makefile.rules | 26 -------------------------- test/Makefile | 10 ---------- 2 files changed, 36 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index cdc61bf8..d74b1c42 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -1877,32 +1877,6 @@ systemtests:: $(EchoCmd) No test directory ; \ fi -check-lit:: check - -check-dg:: - $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \ - if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \ - $(EchoCmd) Running test suite ; \ - $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-dg ; \ - else \ - $(EchoCmd) No Makefile in test directory ; \ - fi ; \ - else \ - $(EchoCmd) No test directory ; \ - fi - -check-all:: - $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \ - if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \ - $(EchoCmd) Running test suite ; \ - $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \ - else \ - $(EchoCmd) No Makefile in test directory ; \ - fi ; \ - else \ - $(EchoCmd) No test directory ; \ - fi - ############################################################################### # UNITTESTS: Running the unittests test suite ############################################################################### diff --git a/test/Makefile b/test/Makefile index c9924244..c96ae889 100644 --- a/test/Makefile +++ b/test/Makefile @@ -45,16 +45,6 @@ endif # Potential support in the future for multiple test suites LIT_ALL_TESTSUITES := $(LIT_TESTSUITE) -check-local:: lit.site.cfg - $(Verb) $(MAKE) -s clean - $(Verb) ( $(ULIMIT) \ - $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) - $(Verb) klee_last_path=$$(find . -name klee-last | head -1); \ - if [ ! -z "$$klee_last_path" ]; then \ - echo "error: one of the tests failed to use --output-dir, found: $$klee_last_path"; \ - exit 1; \ - fi - systemtests-local:: lit.site.cfg $(Verb) ( $(ULIMIT) \ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) -- cgit 1.4.1 From 415232f18a08f5808bcf1582b374e0b7591c0c32 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 19 Dec 2016 12:44:26 +0000 Subject: [CMake] Only add dependencies to `check` if the target is enabled. Surprisingly the old code still worked even when the target didn't exist. --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d392f18..11c7e81b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -699,10 +699,16 @@ if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}")) message(STATUS "Using lit: ${LIT_TOOL}") endif() + # Add global test target + add_custom_target(check + COMMENT "Running tests" + ) + 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() @@ -710,15 +716,11 @@ if ((NOT LIT_TOOL) OR (NOT EXISTS "${LIT_TOOL}")) if (ENABLE_SYSTEM_TESTS) message(STATUS "System tests enabled") add_subdirectory(test) + add_dependencies(check systemtests) else() message(STATUS "System tests disabled") endif() - # Add global test target - add_custom_target(check - DEPENDS unittests systemtests - COMMENT "Running tests" - ) else() message(STATUS "Testing disabled") endif() -- cgit 1.4.1 From 1fce0acbf4498595e3901a6f7fdbe429587e3ef0 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 19 Dec 2016 12:52:40 +0000 Subject: [CMake] If CMP0037 policy is available set it to NEW so that we disallow using reserved target names. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11c7e81b..80224283 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,11 @@ if (POLICY CMP0042) cmake_policy(SET CMP0042 NEW) endif() +if (POLICY CMP0037) + # Disallow reserved target names + cmake_policy(SET CMP0037 NEW) +endif() + # This overrides the default flags for the different CMAKE_BUILD_TYPEs set(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flags_override.cmake") -- cgit 1.4.1