Skip to content

Commit

Permalink
#3282 Update macro for test to avoid using same name as cmake built-i…
Browse files Browse the repository at this point in the history
…n function.

Signed-off-by: Gautier Bureau <gautier.bureau@gmail.com>
  • Loading branch information
gautierbureau committed Jun 19, 2024
1 parent b4193dc commit a533a12
Show file tree
Hide file tree
Showing 36 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions dynawo/cmake/TestCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ add_custom_target(reset-coverage
COMMAND rm -f ${LCOV_OUTPUT_FILE}
COMMAND ${CMAKE_COMMAND} -E make_directory ${GENHTML_OUTPUT_DIR})

add_custom_target(tests-coverage
COMMENT "launch each unit test")
add_custom_target(tests-coverage-run
COMMENT "launch each unit test for coverage")

add_custom_target(export-coverage
COMMAND ${GENHTML_PATH} ${GENHTML_OPTIONS} -o ${GENHTML_OUTPUT_DIR} ${LCOV_OUTPUT_FILE} )
6 changes: 3 additions & 3 deletions dynawo/cmake/UnitTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0")
endif()

function(add_test test-target)
add_dependencies(tests ${test-target})
function(add_test_run test-target)
add_dependencies(tests-run ${test-target})
endfunction()

add_custom_target(tests
add_custom_target(tests-run
COMMENT "launch each unit test")
2 changes: 1 addition & 1 deletion dynawo/sources/API/CRT/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/CRV/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/CSTR/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/DYD/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/EXTVAR/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/FSV/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/JOB/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/LEQ/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/PAR/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/API/TL/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Modeler/Common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Modeler/DataInterface/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Modeler/ModelManager/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Modeler/util/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/ModelicaCompiler/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Models/CPP/ModelNetwork/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Models/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Solvers/Common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
2 changes: 1 addition & 1 deletion dynawo/sources/Solvers/util/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ if(BUILD_TESTS_COVERAGE)
endif()

if(BUILD_TESTS)
add_test(${MODULE_NAME}-tests)
add_test_run(${MODULE_NAME}-tests)
endif()
4 changes: 2 additions & 2 deletions util/envDynawo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ build_tests() {

tests=$@
if [ -z "$tests" ]; then
cmake --build $DYNAWO_BUILD_DIR --target tests --config Debug
cmake --build $DYNAWO_BUILD_DIR --target tests-run --config Debug
else
cmake --build $DYNAWO_BUILD_DIR --target ${tests} --config Debug
fi
Expand Down Expand Up @@ -1105,7 +1105,7 @@ build_tests_coverage() {

cmake --build $DYNAWO_BUILD_DIR --target reset-coverage --config Debug || error_exit "Error during make reset-coverage."
if [ -z "$tests" ]; then
cmake --build $DYNAWO_BUILD_DIR --target tests-coverage --config Debug || error_exit "Error during make tests-coverage."
cmake --build $DYNAWO_BUILD_DIR --target tests-coverage-run --config Debug || error_exit "Error during make tests-coverage."
else
for test in ${tests}; do
cmake --build $DYNAWO_BUILD_DIR --target ${test}-coverage --config Debug || error_exit "Error during make ${test}-coverage."
Expand Down

0 comments on commit a533a12

Please sign in to comment.