Skip to content

Commit

Permalink
Check that plugin exists before adding common test (#523)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
  • Loading branch information
scpeters authored Jul 24, 2023
1 parent 815896d commit 10c7ba4
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions test/common_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,23 @@ set(TEST_INSTALL_DIR ${CMAKE_INSTALL_LIBEXECDIR}/gz/${GZ_DESIGNATION}${PROJECT_V
include(GzPython)

function(configure_common_test PHYSICS_ENGINE_NAME test_name)
set(target_name ${test_name}_${PHYSICS_ENGINE_NAME})
add_test(NAME ${target_name}
COMMAND
${test_name}
$<TARGET_FILE:${PROJECT_LIBRARY_TARGET_NAME}-${PHYSICS_ENGINE_NAME}-plugin>
--gtest_output=xml:${CMAKE_BINARY_DIR}/test_results/${target_name}.xml
)
if(NOT SKIP_${PHYSICS_ENGINE_NAME} AND NOT INTERNAL_SKIP_${PHYSICS_ENGINE_NAME})
set(target_name ${test_name}_${PHYSICS_ENGINE_NAME})
add_test(NAME ${target_name}
COMMAND
${test_name}
$<TARGET_FILE:${PROJECT_LIBRARY_TARGET_NAME}-${PHYSICS_ENGINE_NAME}-plugin>
--gtest_output=xml:${CMAKE_BINARY_DIR}/test_results/${target_name}.xml
)

set_tests_properties(${target_name} PROPERTIES TIMEOUT 240)
set_tests_properties(${target_name} PROPERTIES TIMEOUT 240)

if(Python3_Interpreter_FOUND)
# Check that the test produced a result and create a failure if it didn't.
# Guards against crashed and timed out tests.
add_test(check_${target_name} ${Python3_EXECUTABLE} ${GZ_CMAKE_TOOLS_DIR}/check_test_ran.py
${CMAKE_BINARY_DIR}/test_results/${target_name}.xml)
if(Python3_Interpreter_FOUND)
# Check that the test produced a result and create a failure if it didn't.
# Guards against crashed and timed out tests.
add_test(check_${target_name} ${Python3_EXECUTABLE} ${GZ_CMAKE_TOOLS_DIR}/check_test_ran.py
${CMAKE_BINARY_DIR}/test_results/${target_name}.xml)
endif()
endif()
endfunction()

Expand Down Expand Up @@ -66,12 +68,8 @@ foreach(test ${tests})

install(TARGETS ${test_executable} DESTINATION ${TEST_INSTALL_DIR})

if (${BULLET_FOUND})
configure_common_test("bullet" ${test_executable})
configure_common_test("bullet-featherstone" ${test_executable})
endif()
if (${DART_FOUND})
configure_common_test("dartsim" ${test_executable})
endif()
configure_common_test("bullet" ${test_executable})
configure_common_test("bullet-featherstone" ${test_executable})
configure_common_test("dartsim" ${test_executable})
configure_common_test("tpe" ${test_executable})
endforeach()

0 comments on commit 10c7ba4

Please sign in to comment.