Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarpidl tests moved/refactored #2964

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 2 additions & 46 deletions src/yarpidl_rosmsg/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,5 @@
# SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause

macro(add_yarpidl_rosmsg_test name wd file check_file)
# Run the test
add_test(
NAME idl::rosmsg::${name}::run
COMMAND yarpidl_rosmsg --verbose --no-ros true --out "${CMAKE_CURRENT_BINARY_DIR}/${name}" "${file}"
WORKING_DIRECTORY "${wd}"
)
set_tests_properties(idl::rosmsg::${name}::run PROPERTIES FIXTURES_SETUP yarpidl_rosmsg_${name}_run)
set_tests_properties(idl::rosmsg::${name}::run PROPERTIES LABELS "yarp::idl::rosmsg")

# Check if the file was generated by trying to generate md5sum
add_test(
NAME idl::rosmsg::${name}::check
COMMAND ${CMAKE_COMMAND} -E md5sum "${CMAKE_CURRENT_BINARY_DIR}/${name}/${check_file}"
WORKING_DIRECTORY "${wd}"
)
set_tests_properties(idl::rosmsg::${name}::check PROPERTIES FIXTURES_REQUIRED yarpidl_rosmsg_${name}_run)
set_tests_properties(idl::rosmsg::${name}::check PROPERTIES LABELS "yarp::idl::rosmsg")

# Cleanup
add_test(
NAME idl::rosmsg::${name}::cleanup
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/${name}"
WORKING_DIRECTORY "${wd}"
)
set_tests_properties(idl::rosmsg::${name}::cleanup PROPERTIES FIXTURES_CLEANUP yarpidl_rosmsg_${name}_run)
set_tests_properties(idl::rosmsg::${name}::cleanup PROPERTIES LABELS "yarp::idl::rosmsg")

set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}")
endmacro()


# Try generating the files using different combinations of current working
# directory and path to the file
add_yarpidl_rosmsg_test(test1 "${CMAKE_CURRENT_SOURCE_DIR}/demo" Demo.msg yarp/rosmsg/Demo.h)
add_yarpidl_rosmsg_test(test2 "${CMAKE_CURRENT_SOURCE_DIR}" demo/Demo.msg yarp/rosmsg/demo/Demo.h)

if(YARP_ENABLE_BROKEN_TESTS)
add_yarpidl_rosmsg_test(test3 "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/demo/Demo.msg" yarp/rosmsg/demo/Demo.h)
endif()

# Try using the type name
if(YARP_ENABLE_BROKEN_TESTS)
add_yarpidl_rosmsg_test(test6 "${CMAKE_CURRENT_SOURCE_DIR}/demo" Demo yarp/rosmsg/.h)
add_yarpidl_rosmsg_test(test7 "${CMAKE_CURRENT_SOURCE_DIR}" demo/Demo yarp/rosmsg/demo/Demo.h)
endif()
add_subdirectory(test1_catch)
add_subdirectory(test2_generation)
49 changes: 49 additions & 0 deletions src/yarpidl_rosmsg/tests/test2_generation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause

macro(add_yarpidl_rosmsg_test name wd file check_file)
# Run the test
add_test(
NAME idl::rosmsg::${name}::run
COMMAND yarpidl_rosmsg --verbose --no-ros true --out "${CMAKE_CURRENT_BINARY_DIR}/${name}" "${file}"
WORKING_DIRECTORY "${wd}"
)
set_tests_properties(idl::rosmsg::${name}::run PROPERTIES FIXTURES_SETUP yarpidl_rosmsg_${name}_run)
set_tests_properties(idl::rosmsg::${name}::run PROPERTIES LABELS "yarp::idl::rosmsg")

# Check if the file was generated by trying to generate md5sum
add_test(
NAME idl::rosmsg::${name}::check
COMMAND ${CMAKE_COMMAND} -E md5sum "${CMAKE_CURRENT_BINARY_DIR}/${name}/${check_file}"
WORKING_DIRECTORY "${wd}"
)
set_tests_properties(idl::rosmsg::${name}::check PROPERTIES FIXTURES_REQUIRED yarpidl_rosmsg_${name}_run)
set_tests_properties(idl::rosmsg::${name}::check PROPERTIES LABELS "yarp::idl::rosmsg")

# Cleanup
add_test(
NAME idl::rosmsg::${name}::cleanup
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/${name}"
WORKING_DIRECTORY "${wd}"
)
set_tests_properties(idl::rosmsg::${name}::cleanup PROPERTIES FIXTURES_CLEANUP yarpidl_rosmsg_${name}_run)
set_tests_properties(idl::rosmsg::${name}::cleanup PROPERTIES LABELS "yarp::idl::rosmsg")

set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}")
endmacro()


# Try generating the files using different combinations of current working
# directory and path to the file
add_yarpidl_rosmsg_test(test1 "${CMAKE_CURRENT_SOURCE_DIR}/demo" Demo.msg yarp/rosmsg/Demo.h)
add_yarpidl_rosmsg_test(test2 "${CMAKE_CURRENT_SOURCE_DIR}" demo/Demo.msg yarp/rosmsg/demo/Demo.h)

if(YARP_ENABLE_BROKEN_TESTS)
add_yarpidl_rosmsg_test(test3 "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/demo/Demo.msg" yarp/rosmsg/demo/Demo.h)
endif()

# Try using the type name
if(YARP_ENABLE_BROKEN_TESTS)
add_yarpidl_rosmsg_test(test6 "${CMAKE_CURRENT_SOURCE_DIR}/demo" Demo yarp/rosmsg/.h)
add_yarpidl_rosmsg_test(test7 "${CMAKE_CURRENT_SOURCE_DIR}" demo/Demo yarp/rosmsg/demo/Demo.h)
endif()
46 changes: 2 additions & 44 deletions src/yarpidl_thrift/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,47 +1,5 @@
# SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause

macro(add_yarpidl_thrift_test name wd file check_file)
# FIXME directory is not created automatically by yarpidl_thrift
add_test(
NAME idl::thrift::${name}::setup
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${name}"
)
set_tests_properties(idl::thrift::${name}::setup PROPERTIES FIXTURES_SETUP yarpidl_thrift_${name}_setup)

# Run the test
add_test(
NAME idl::thrift::${name}::run
COMMAND yarpidl_thrift --out "${CMAKE_CURRENT_BINARY_DIR}/${name}" --gen yarp "${file}"
WORKING_DIRECTORY "${wd}"
)
set_tests_properties(idl::thrift::${name}::run PROPERTIES FIXTURES_REQUIRED yarpidl_thrift_${name}_setup)
set_tests_properties(idl::thrift::${name}::run PROPERTIES FIXTURES_SETUP yarpidl_thrift_${name}_run)
set_tests_properties(idl::thrift::${name}::run PROPERTIES LABELS "yarp::idl::thrift")

# Check if the file was generated by trying to generate md5sum
add_test(
NAME idl::thrift::${name}::check
COMMAND ${CMAKE_COMMAND} -E md5sum "${CMAKE_CURRENT_BINARY_DIR}/${name}/${check_file}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demo"
)
set_tests_properties(idl::thrift::${name}::check PROPERTIES FIXTURES_REQUIRED yarpidl_thrift_${name}_run)
set_tests_properties(idl::thrift::${name}::check PROPERTIES LABELS "yarp::idl::thrift")

# Cleanup
add_test(
NAME idl::thrift::${name}::cleanup
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/${name}"
)
set_tests_properties(idl::thrift::${name}::cleanup PROPERTIES FIXTURES_CLEANUP "yarpidl_thrift_${name}_setup;yarpidl_thrift_${name}_run")
set_tests_properties(idl::thrift::${name}::cleanup PROPERTIES LABELS "yarp::idl::thrift")

set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}")
endmacro()


# Try generating the files using different combinations of current working
# directory and path to the file
add_yarpidl_thrift_test(test1 "${CMAKE_CURRENT_SOURCE_DIR}/demo" demo.thrift Demo.h)
add_yarpidl_thrift_test(test2 "${CMAKE_CURRENT_SOURCE_DIR}" demo/demo.thrift Demo.h)
add_yarpidl_thrift_test(test3 "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/demo/demo.thrift" Demo.h)
add_subdirectory(test1_catch)
add_subdirectory(test2_generation)
47 changes: 47 additions & 0 deletions src/yarpidl_thrift/tests/test2_generation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause

macro(add_yarpidl_thrift_test name wd file check_file)
# FIXME directory is not created automatically by yarpidl_thrift
add_test(
NAME idl::thrift::${name}::setup
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${name}"
)
set_tests_properties(idl::thrift::${name}::setup PROPERTIES FIXTURES_SETUP yarpidl_thrift_${name}_setup)

# Run the test
add_test(
NAME idl::thrift::${name}::run
COMMAND yarpidl_thrift --out "${CMAKE_CURRENT_BINARY_DIR}/${name}" --gen yarp "${file}"
WORKING_DIRECTORY "${wd}"
)
set_tests_properties(idl::thrift::${name}::run PROPERTIES FIXTURES_REQUIRED yarpidl_thrift_${name}_setup)
set_tests_properties(idl::thrift::${name}::run PROPERTIES FIXTURES_SETUP yarpidl_thrift_${name}_run)
set_tests_properties(idl::thrift::${name}::run PROPERTIES LABELS "yarp::idl::thrift")

# Check if the file was generated by trying to generate md5sum
add_test(
NAME idl::thrift::${name}::check
COMMAND ${CMAKE_COMMAND} -E md5sum "${CMAKE_CURRENT_BINARY_DIR}/${name}/${check_file}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demo"
)
set_tests_properties(idl::thrift::${name}::check PROPERTIES FIXTURES_REQUIRED yarpidl_thrift_${name}_run)
set_tests_properties(idl::thrift::${name}::check PROPERTIES LABELS "yarp::idl::thrift")

# Cleanup
add_test(
NAME idl::thrift::${name}::cleanup
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/${name}"
)
set_tests_properties(idl::thrift::${name}::cleanup PROPERTIES FIXTURES_CLEANUP "yarpidl_thrift_${name}_setup;yarpidl_thrift_${name}_run")
set_tests_properties(idl::thrift::${name}::cleanup PROPERTIES LABELS "yarp::idl::thrift")

set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}")
endmacro()


# Try generating the files using different combinations of current working
# directory and path to the file
add_yarpidl_thrift_test(test1 "${CMAKE_CURRENT_SOURCE_DIR}/demo" demo.thrift Demo.h)
add_yarpidl_thrift_test(test2 "${CMAKE_CURRENT_SOURCE_DIR}" demo/demo.thrift Demo.h)
add_yarpidl_thrift_test(test3 "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/demo/demo.thrift" Demo.h)
3 changes: 0 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ set_property(TARGET YARP_harness_no_network PROPERTY FOLDER "Test")

add_subdirectory(misc)

add_subdirectory(yarpidl_thrift)
add_subdirectory(yarpidl_rosmsg)

add_subdirectory(devices)

add_subdirectory(integration)