forked from Archive/PX4-Autopilot
mavsdk_tests: build should be independant of px4
This commit is contained in:
parent
7775dfbc56
commit
1edfee4fdd
|
@ -393,9 +393,6 @@ add_custom_target(test_results
|
|||
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
||||
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
# Integration testing using MAVSDK
|
||||
add_subdirectory(test/mavsdk_tests)
|
||||
|
||||
#=============================================================================
|
||||
# subdirectories
|
||||
#
|
||||
|
|
4
Makefile
4
Makefile
|
@ -359,12 +359,14 @@ rostest: px4_sitl_default
|
|||
|
||||
tests_integration: px4_sitl_default
|
||||
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo
|
||||
@$(MAKE) --no-print-directory px4_sitl_default mavsdk_tests
|
||||
@"$(SRC_DIR)"/test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 100
|
||||
|
||||
tests_integration_coverage:
|
||||
@$(MAKE) clean
|
||||
@$(MAKE) --no-print-directory px4_sitl_default PX4_CMAKE_BUILD_TYPE=Coverage
|
||||
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo PX4_CMAKE_BUILD_TYPE=Coverage
|
||||
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo
|
||||
@$(MAKE) --no-print-directory px4_sitl_default mavsdk_tests
|
||||
@"$(SRC_DIR)"/test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 20 --iterations 1 --fail-early
|
||||
|
||||
tests_mission: rostest
|
||||
|
|
|
@ -45,6 +45,18 @@ ExternalProject_Add(sitl_gazebo
|
|||
BUILD_ALWAYS 1
|
||||
)
|
||||
|
||||
ExternalProject_Add(mavsdk_tests
|
||||
SOURCE_DIR ${PX4_SOURCE_DIR}/test/mavsdk_tests
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
|
||||
BINARY_DIR ${PX4_BINARY_DIR}/mavsdk_tests
|
||||
INSTALL_COMMAND ""
|
||||
USES_TERMINAL_CONFIGURE true
|
||||
USES_TERMINAL_BUILD true
|
||||
EXCLUDE_FROM_ALL true
|
||||
BUILD_ALWAYS 1
|
||||
)
|
||||
|
||||
# create targets for each viewer/model/debugger combination
|
||||
set(viewers none jmavsim gazebo)
|
||||
set(debuggers none ide gdb lldb ddd valgrind callgrind)
|
||||
|
|
|
@ -1,25 +1,30 @@
|
|||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
if(${PX4_BOARD_MODEL} MATCHES "sitl")
|
||||
find_package(MAVSDK QUIET)
|
||||
project(mavsdk_tests CXX)
|
||||
|
||||
if (MAVSDK_FOUND)
|
||||
add_executable(mavsdk_tests
|
||||
test_main.cpp
|
||||
autopilot_tester.cpp
|
||||
test_mission_multicopter.cpp
|
||||
)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
target_link_libraries(mavsdk_tests
|
||||
MAVSDK::mavsdk
|
||||
MAVSDK::mavsdk_action
|
||||
MAVSDK::mavsdk_mission
|
||||
MAVSDK::mavsdk_telemetry
|
||||
)
|
||||
find_package(MAVSDK QUIET)
|
||||
|
||||
target_compile_options(mavsdk_tests
|
||||
PRIVATE -std=c++17 -Wall -Wextra -Werror)
|
||||
else()
|
||||
message("MAVSDK C++ not found, skipping mavsdk_tests build..")
|
||||
endif()
|
||||
if(MAVSDK_FOUND)
|
||||
add_executable(mavsdk_tests
|
||||
test_main.cpp
|
||||
autopilot_tester.cpp
|
||||
test_mission_multicopter.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(mavsdk_tests
|
||||
MAVSDK::mavsdk
|
||||
MAVSDK::mavsdk_action
|
||||
MAVSDK::mavsdk_mission
|
||||
MAVSDK::mavsdk_telemetry
|
||||
)
|
||||
|
||||
target_compile_options(mavsdk_tests
|
||||
PRIVATE -Wall -Wextra -Werror
|
||||
)
|
||||
else()
|
||||
message("MAVSDK C++ not found, skipping mavsdk_tests build..")
|
||||
endif()
|
||||
|
|
|
@ -140,13 +140,13 @@ class TestRunner(Runner):
|
|||
super().__init__(log_dir)
|
||||
self.env = {"PATH": os.environ['PATH']}
|
||||
self.cmd = workspace_dir + \
|
||||
"/build/px4_sitl_default/mavsdk_tests"
|
||||
"/build/px4_sitl_default/mavsdk_tests/mavsdk_tests"
|
||||
self.args = [test]
|
||||
self.log_prefix = "test_runner"
|
||||
|
||||
|
||||
def determine_tests(workspace_dir, filter):
|
||||
cmd = workspace_dir + "/build/px4_sitl_default/mavsdk_tests"
|
||||
cmd = workspace_dir + "/build/px4_sitl_default/mavsdk_tests/mavsdk_tests"
|
||||
args = ["--list-test-names-only", filter]
|
||||
p = subprocess.Popen(
|
||||
[cmd] + args,
|
||||
|
@ -183,7 +183,7 @@ def is_everything_ready():
|
|||
"run `PX4_MAVSDK_TESTING=y DONT_RUN=1 "
|
||||
"make px4_sitl gazebo mavsdk_tests`")
|
||||
result = False
|
||||
if not os.path.isfile('build/px4_sitl_default/mavsdk_tests'):
|
||||
if not os.path.isfile('build/px4_sitl_default/mavsdk_tests/mavsdk_tests'):
|
||||
print("Test runner is not built\n"
|
||||
"run `PX4_MAVSDK_TESTING=y DONT_RUN=1 "
|
||||
"make px4_sitl gazebo mavsdk_tests`")
|
||||
|
|
Loading…
Reference in New Issue