setup_target_for_coverage_lcov(
NAME coverage
EXECUTABLE
- ctest -j${CTEST_NTHREADS} -LE "example" --output-on-failure $(ARGS)
- DEPENDENCIES cvc4-bin)
+ ctest -j${CTEST_NTHREADS} -LE "example" --output-on-failure $(ARGS))
endif()
if(ENABLE_DEBUG_CONTEXT_MM)
+#-----------------------------------------------------------------------------#
+# Add target 'check', builds and runs
+# > unit tests
+# > regression tests of levels 0 and 1
+# > system tests
+
+# Note: Do not add custom targets for running tests (regress, systemtests,
+# units) as dependencies to other run targets. This will result in executing
+# tests multiple times. For example, if check would depend on regress it would
+# first run the command of the regress target (i.e., run all regression tests)
+# and afterwards run the command specified for the check target.
+# Dependencies of check are added in the corresponding subdirectories.
+add_custom_target(check
+ COMMAND
+ ctest --output-on-failure -LE "regress[2-4]" -j${CTEST_NTHREADS} $(ARGS))
+
#-----------------------------------------------------------------------------#
# Add subdirectories
if(ENABLE_UNIT_TESTING)
add_subdirectory(unit EXCLUDE_FROM_ALL)
endif()
-
-#-----------------------------------------------------------------------------#
-# Add target 'check', builds and runs
-# > unit tests
-# > regression tests of levels 0 and 1
-# > system tests
-
-add_custom_target(check
- COMMAND
- ctest --output-on-failure -LE "regress[2-4]" -j${CTEST_NTHREADS} $(ARGS)
- DEPENDS regress systemtests)
-if(BUILD_BINDINGS_JAVA)
- add_dependencies(check cvc4javatests)
-endif()
-if(ENABLE_UNIT_TESTING)
- add_dependencies(check units)
-endif()
LinearArith.java
)
-add_jar(cvc4javatests
+add_jar(build-javatests
SOURCES ${java_test_src_files}
INCLUDE_JARS
${CMAKE_BINARY_DIR}/src/bindings/java/CVC4.jar
${JUnit_JAR}
+ OUTPUT_NAME javatests
)
-add_dependencies(cvc4javatests cvc4jar)
+add_dependencies(build-javatests cvc4jar)
+add_dependencies(check build-javatests)
# Add java tests to ctest
-set(classpath "${CMAKE_CURRENT_BINARY_DIR}/cvc4javatests.jar")
+set(classpath "${CMAKE_CURRENT_BINARY_DIR}/javatests.jar")
set(classpath "${classpath}:${CMAKE_BINARY_DIR}/src/bindings/java/CVC4.jar")
set(classpath "${classpath}:${JUnit_JAR}:${JUnit_JAR_DEPS}")
get_target_property(path_to_cvc4 cvc4-bin RUNTIME_OUTPUT_DIRECTORY)
set(run_regress_script ${CMAKE_CURRENT_LIST_DIR}/run_regression.py)
+add_custom_target(build-regress DEPENDS cvc4-bin)
+add_dependencies(check build-regress)
+if(ENABLE_COVERAGE)
+ add_dependencies(coverage build-regress)
+endif()
+
add_custom_target(regress
COMMAND
ctest --output-on-failure -L "regress[0-1]" -j${CTEST_NTHREADS} $(ARGS)
- DEPENDS cvc4-bin)
+ DEPENDS build-regress)
macro(cvc4_add_regression_test level file)
add_test(${file}
# Add target 'systemtests', builds and runs
# > system tests
+add_custom_target(build-systemtests)
+add_dependencies(check build-systemtests)
+if(ENABLE_COVERAGE)
+ add_dependencies(coverage build-systemtests)
+endif()
+
add_custom_target(systemtests
COMMAND ctest --output-on-failure -L "system" -j${CTEST_NTHREADS} $(ARGS)
- DEPENDS main-test)
+ DEPENDS build-systemtests)
set(CVC4_SYSTEM_TEST_FLAGS
-D__BUILDING_CVC4_SYSTEM_TEST -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS)
target_compile_definitions(${name} PRIVATE ${CVC4_SYSTEM_TEST_FLAGS})
add_test(system/${name} ${CMAKE_CURRENT_BINARY_DIR}/${name})
set_tests_properties(system/${name} PROPERTIES LABELS "system")
- add_dependencies(systemtests ${name})
- if(ENABLE_COVERAGE)
- add_dependencies(coverage ${name})
- endif()
+ add_dependencies(build-systemtests ${name})
endmacro()
cvc4_add_system_test(boilerplate)
# Add target 'units', builds and runs
# > unit tests
+add_custom_target(build-units)
+add_dependencies(check build-units)
+if(ENABLE_COVERAGE)
+ add_dependencies(coverage build-units)
+endif()
+
add_custom_target(units
- COMMAND ctest --output-on-failure -L "unit" -j${CTEST_NTHREADS} $(ARGS))
+ COMMAND ctest --output-on-failure -L "unit" -j${CTEST_NTHREADS} $(ARGS)
+ DEPENDS build-units)
set(CVC4_CXXTEST_FLAGS_BLACK
-D__BUILDING_CVC4LIB_UNIT_TEST -D__BUILDING_CVC4PARSERLIB_UNIT_TEST
# Disable the Wsuggest-override warnings for the unit tests. CxxTest generates
# code that does not properly add the override keyword to runTest().
target_compile_options(${name} PRIVATE -Wno-suggest-override)
- add_dependencies(units ${name})
+ add_dependencies(build-units ${name})
# Generate into bin/test/unit/<output_dir>.
set(test_bin_dir ${CMAKE_BINARY_DIR}/bin/test/unit/${output_dir})
set_target_properties(${name}
endif()
add_test(${test_name} ${test_bin_dir}/${name})
set_tests_properties(${test_name} PROPERTIES LABELS "unit")
- if(ENABLE_COVERAGE)
- add_dependencies(coverage ${name})
- endif()
endmacro()
macro(cvc4_add_unit_test_black name output_dir)