Skip to content

Commit 8f48a06

Browse files
authored
Make downloading and checking RTDE outputs from docs optional (UniversalRobots#493)
It's not particularly nice to require internet access to build the project every time. Also, this reduces build requirements to run integration tests so we don't need python3 and pandas to run integration tests.
1 parent fbe69fc commit 8f48a06

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
-DWITH_ASAN=ON
6868
-DPRIMARY_CLIENT_STRICT_PARSING=ON
6969
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
70+
-DCHECK_RTDE_DOCS_RECIPE=ON
7071
env:
7172
CXXFLAGS: -g -O2 -fprofile-arcs -ftest-coverage
7273
CFLAGS: -g -O2 -fprofile-arcs -ftest-coverage

tests/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,27 @@ include(GoogleTest)
2121

2222
option(INTEGRATION_TESTS "Build the integration tests that require a running robot / URSim" OFF)
2323
option(POLYSCOPE_X_TESTS_WITH_REMOTE_CONTROL "Run Polyscope X tests that require remote control" OFF)
24+
option(CHECK_RTDE_DOCS_RECIPE "Fetch the RTDE documentation to auto-generate a recipe containing all output fields and check that with the RTDE client. Requires python3 and pandas and an internet connection." OFF)
2425
# Build Tests
2526
if (INTEGRATION_TESTS)
2627
# Integration tests require a robot reachable at 192.168.56.101. Therefore, they have to be
2728
# activated separately.
2829

29-
find_package(Python3 COMPONENTS Interpreter REQUIRED)
3030
if(POLYSCOPE_X_TESTS_WITH_REMOTE_CONTROL)
3131
add_compile_definitions(POLYSCOPE_X_TESTS_WITH_REMOTE_CONTROL=1 )
3232
endif()
3333

34-
add_custom_target(generate_outputs ALL COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/resources/generate_rtde_outputs.py)
3534
add_executable(rtde_tests test_rtde_client.cpp fake_rtde_server.cpp)
36-
add_dependencies(rtde_tests generate_outputs)
3735
target_link_libraries(rtde_tests PRIVATE ur_client_library::urcl GTest::gtest_main)
3836
gtest_add_tests(TARGET rtde_tests
3937
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
4038
)
39+
if (CHECK_RTDE_DOCS_RECIPE)
40+
find_package(Python3 COMPONENTS Interpreter REQUIRED)
41+
add_custom_target(generate_outputs ALL COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/resources/generate_rtde_outputs.py)
42+
add_dependencies(rtde_tests generate_outputs)
43+
target_compile_definitions(rtde_tests PRIVATE CHECK_RTDE_DOCS_RECIPE=1)
44+
endif()
4145

4246
add_executable(dashboard_client_g5_tests test_dashboard_client_g5.cpp)
4347
target_link_libraries(dashboard_client_g5_tests PRIVATE ur_client_library::urcl GTest::gtest_main)

tests/test_rtde_client.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ TEST_F(RTDEClientTest, check_all_rtde_output_variables_exist)
681681
client_->pause();
682682
}
683683

684+
#ifdef CHECK_RTDE_DOCS_RECIPE
684685
TEST_F(RTDEClientTest, check_rtde_data_fields_match_docs)
685686
{
686687
std::ifstream docs_file(docs_output_recipe_file_);
@@ -725,6 +726,7 @@ TEST_F(RTDEClientTest, check_rtde_data_fields_match_docs)
725726
GTEST_FAIL();
726727
}
727728
}
729+
#endif
728730

729731
TEST_F(RTDEClientTest, check_unknown_rtde_output_variable)
730732
{

0 commit comments

Comments
 (0)