File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,19 @@ option(INTEGRATION_TESTS "Build the integration tests that require a running rob
2121if (INTEGRATION_TESTS)
2222 # Integration tests require a robot reachable at 192.168.56.101. Therefore, they have to be
2323 # activated separately.
24+
25+ find_package (Python3 COMPONENTS Interpreter REQUIRED)
26+
27+ add_custom_command (
28+ OUTPUT ${CMAKE_CURRENT_SOURCE_DIR} /resources/exhaustive_rtde_output_recipe.txt
29+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} /resources/generate_rtde_outputs.py
30+ BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR} /resources/exhaustive_rtde_output_recipe.txt
31+ )
32+
33+ add_custom_target (generate_outputs ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /resources/exhaustive_rtde_output_recipe.txt)
34+
2435 add_executable (rtde_tests test_rtde_client.cpp)
36+ add_dependencies (rtde_tests generate_outputs)
2537 target_link_libraries (rtde_tests PRIVATE ur_client_library::urcl GTest::gtest_main)
2638 gtest_add_tests(TARGET rtde_tests
2739 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -111,6 +123,8 @@ target_link_libraries(primary_parser_tests PRIVATE ur_client_library::urcl GTest
111123gtest_add_tests(TARGET primary_parser_tests
112124)
113125
126+
127+
114128add_executable (rtde_data_package_tests test_rtde_data_package.cpp)
115129target_link_libraries (rtde_data_package_tests PRIVATE ur_client_library::urcl GTest::gtest_main)
116130gtest_add_tests(TARGET rtde_data_package_tests
Original file line number Diff line number Diff line change 1+ import pathlib
2+
3+ URCL_PATH = pathlib .Path (__file__ ).parent .parent .parent .resolve ()
4+
5+ PKG_PATH = [i for i in pathlib .Path (URCL_PATH .as_posix ()).glob ("**/data_package.cpp" )]
6+
7+ assert len (PKG_PATH ) == 1
8+
9+ PKG_PATH = PKG_PATH [0 ].resolve ()
10+
11+ OUTPUT_PATH = pathlib .Path (__file__ ).parent .resolve ().as_posix () + "/exhaustive_rtde_output_recipe.txt"
12+
13+ with open (PKG_PATH ) as pkg_file :
14+ save_outputs = False
15+ outputs = []
16+ while True :
17+ line = pkg_file .readline ()
18+ if not line :
19+ break
20+ if "// INPUT / OUTPUT" in line :
21+ save_outputs = True
22+ if save_outputs :
23+ if "//" not in line and len (line ) > 1 :
24+ outputs .append (line .split ('"' )[1 ] + "\n " )
25+ if "// NOT IN OFFICIAL DOCS" in line :
26+ break
27+
28+ with open (OUTPUT_PATH , "w" ) as output_file :
29+ output_file .writelines (outputs )
You can’t perform that action at this time.
0 commit comments