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})
|
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
||||||
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
|
|
||||||
# Integration testing using MAVSDK
|
|
||||||
add_subdirectory(test/mavsdk_tests)
|
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# subdirectories
|
# subdirectories
|
||||||
#
|
#
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -359,12 +359,14 @@ rostest: px4_sitl_default
|
||||||
|
|
||||||
tests_integration: px4_sitl_default
|
tests_integration: px4_sitl_default
|
||||||
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo
|
@$(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
|
@"$(SRC_DIR)"/test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 100
|
||||||
|
|
||||||
tests_integration_coverage:
|
tests_integration_coverage:
|
||||||
@$(MAKE) clean
|
@$(MAKE) clean
|
||||||
@$(MAKE) --no-print-directory px4_sitl_default PX4_CMAKE_BUILD_TYPE=Coverage
|
@$(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
|
@"$(SRC_DIR)"/test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 20 --iterations 1 --fail-early
|
||||||
|
|
||||||
tests_mission: rostest
|
tests_mission: rostest
|
||||||
|
|
|
@ -45,6 +45,18 @@ ExternalProject_Add(sitl_gazebo
|
||||||
BUILD_ALWAYS 1
|
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
|
# create targets for each viewer/model/debugger combination
|
||||||
set(viewers none jmavsim gazebo)
|
set(viewers none jmavsim gazebo)
|
||||||
set(debuggers none ide gdb lldb ddd valgrind callgrind)
|
set(debuggers none ide gdb lldb ddd valgrind callgrind)
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
cmake_minimum_required(VERSION 3.5.1)
|
cmake_minimum_required(VERSION 3.5.1)
|
||||||
|
|
||||||
if(${PX4_BOARD_MODEL} MATCHES "sitl")
|
project(mavsdk_tests CXX)
|
||||||
find_package(MAVSDK QUIET)
|
|
||||||
|
|
||||||
if (MAVSDK_FOUND)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
find_package(MAVSDK QUIET)
|
||||||
|
|
||||||
|
if(MAVSDK_FOUND)
|
||||||
add_executable(mavsdk_tests
|
add_executable(mavsdk_tests
|
||||||
test_main.cpp
|
test_main.cpp
|
||||||
autopilot_tester.cpp
|
autopilot_tester.cpp
|
||||||
|
@ -18,8 +23,8 @@ if(${PX4_BOARD_MODEL} MATCHES "sitl")
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(mavsdk_tests
|
target_compile_options(mavsdk_tests
|
||||||
PRIVATE -std=c++17 -Wall -Wextra -Werror)
|
PRIVATE -Wall -Wextra -Werror
|
||||||
else()
|
)
|
||||||
|
else()
|
||||||
message("MAVSDK C++ not found, skipping mavsdk_tests build..")
|
message("MAVSDK C++ not found, skipping mavsdk_tests build..")
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -140,13 +140,13 @@ class TestRunner(Runner):
|
||||||
super().__init__(log_dir)
|
super().__init__(log_dir)
|
||||||
self.env = {"PATH": os.environ['PATH']}
|
self.env = {"PATH": os.environ['PATH']}
|
||||||
self.cmd = workspace_dir + \
|
self.cmd = workspace_dir + \
|
||||||
"/build/px4_sitl_default/mavsdk_tests"
|
"/build/px4_sitl_default/mavsdk_tests/mavsdk_tests"
|
||||||
self.args = [test]
|
self.args = [test]
|
||||||
self.log_prefix = "test_runner"
|
self.log_prefix = "test_runner"
|
||||||
|
|
||||||
|
|
||||||
def determine_tests(workspace_dir, filter):
|
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]
|
args = ["--list-test-names-only", filter]
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
[cmd] + args,
|
[cmd] + args,
|
||||||
|
@ -183,7 +183,7 @@ def is_everything_ready():
|
||||||
"run `PX4_MAVSDK_TESTING=y DONT_RUN=1 "
|
"run `PX4_MAVSDK_TESTING=y DONT_RUN=1 "
|
||||||
"make px4_sitl gazebo mavsdk_tests`")
|
"make px4_sitl gazebo mavsdk_tests`")
|
||||||
result = False
|
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"
|
print("Test runner is not built\n"
|
||||||
"run `PX4_MAVSDK_TESTING=y DONT_RUN=1 "
|
"run `PX4_MAVSDK_TESTING=y DONT_RUN=1 "
|
||||||
"make px4_sitl gazebo mavsdk_tests`")
|
"make px4_sitl gazebo mavsdk_tests`")
|
||||||
|
|
Loading…
Reference in New Issue