Skip to content

Commit

Permalink
added tests for all profiles of d455 415 based on the inputs from rs-…
Browse files Browse the repository at this point in the history
…enumerate-devices
  • Loading branch information
PrasRsRos committed Aug 4, 2023
1 parent a9fcee4 commit 8fa253f
Show file tree
Hide file tree
Showing 5 changed files with 315 additions and 111 deletions.
36 changes: 28 additions & 8 deletions realsense2_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,36 +303,56 @@ if(BUILD_TESTING)
test/rosbag
test/post_processing_filters
)



foreach(test_folder ${_pytest_folders})
file(GLOB files "${test_folder}/test_*.py")
foreach(file ${files})

get_filename_component(_test_name ${file} NAME_WE)
ament_add_pytest_test(${_test_name} ${file}
APPEND_ENV PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_SOURCE_DIR}/test/utils:${CMAKE_SOURCE_DIR}/launch:${CMAKE_SOURCE_DIR}/scripts
TIMEOUT 60
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endforeach()
endforeach()

unset(_pytest_folders)

set(rs_query_cmd "rs-enumerate-devices -s")
execute_process(COMMAND bash -c ${rs_query_cmd}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE rs_result
OUTPUT_VARIABLE RS_DEVICE_INFO)

# message(STATUS "rs_result ${rs_result}")
message(STATUS "rs_device_info:")
message(STATUS "${RS_DEVICE_INFO}")
if(RS_DEVICE_INFO MATCHES "D455")
message(STATUS "D455 device found")
set(_pytest_folders
${_pytest_folders}
test/d455
set(_pytest_live_folders
test/live_camera
)
elseif(RS_DEVICE_INFO MATCHES "D415")
message(STATUS "D415 device found")
set(_pytest_live_folders
test/live_camera
)
endif()


foreach(test_folder ${_pytest_folders})
foreach(test_folder ${_pytest_live_folders})
file(GLOB files "${test_folder}/test_*.py")
foreach(file ${files})

get_filename_component(_test_name ${file} NAME_WE)
ament_add_pytest_test(${_test_name} ${file}
APPEND_ENV PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_SOURCE_DIR}/test/utils:${CMAKE_SOURCE_DIR}/launch:${CMAKE_SOURCE_DIR}/scripts
TIMEOUT 60
TIMEOUT 500
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endforeach()
endforeach()

endif()

# Ament exports
Expand Down
101 changes: 0 additions & 101 deletions realsense2_camera/test/d455/test_d455_all_profile_tests.py

This file was deleted.

Loading

0 comments on commit 8fa253f

Please sign in to comment.