Integration tests: Add Makefile target

This enables unfamiliar users to run the tests quickly without having to memorize all commandsline options.
This commit is contained in:
Lorenz Meier 2019-12-24 10:58:21 +01:00
parent cd75cc08d3
commit 663436fd47
4 changed files with 23 additions and 25 deletions

View File

@ -12,9 +12,8 @@ jobs:
run: update-alternatives --install /usr/bin/python python /usr/bin/python3 10
- name: Install psutil
run: pip3 install psutil
- name: Build PX4 in simulation mode
- name: Build PX4 in SITL integration test mode
# Build all targets
run: make px4_sitl_default sitl_gazebo mavsdk_tests
# Check: Are the env variables needed?run: PX4_MAVSDK_TESTING=y DONT_RUN=1 make px4_sitl gazebo mavsdk_tests
run: DONT_RUN=1 make px4_sitl gazebo mavsdk_tests
- name: Run simulation tests
run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 100

View File

@ -387,10 +387,7 @@ add_custom_target(test_results
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
# Integration testing using MAVSDK
option(MAVSDK_TESTING "Integration testing using MAVSDK" OFF)
if (MAVSDK_TESTING)
add_subdirectory(test/mavsdk_tests)
endif()
add_subdirectory(test/mavsdk_tests)
#=============================================================================
# subdirectories

View File

@ -141,10 +141,6 @@ else
endif
ifdef PX4_MAVSDK_TESTING
CMAKE_ARGS += -DMAVSDK_TESTING=ON
endif
# Functions
# --------------------------------------------------------------------
# describe how to build a cmake config
@ -361,6 +357,10 @@ tests_coverage:
rostest: px4_sitl_default
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo
tests_integration: px4_sitl gazebo mavsdk_tests
# Missing step: Gazebo model generation
@"$(SRC_DIR)"/test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 100
tests_mission: rostest
@"$(SRC_DIR)"/test/rostest_px4_run.sh mavros_posix_tests_missions.test

View File

@ -1,19 +1,21 @@
cmake_minimum_required(VERSION 3.5.1)
find_package(MAVSDK REQUIRED)
find_package(MAVSDK)
add_executable(mavsdk_tests
test_main.cpp
autopilot_tester.cpp
test_mission_multicopter.cpp
)
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_link_libraries(mavsdk_tests
MAVSDK::mavsdk
MAVSDK::mavsdk_action
MAVSDK::mavsdk_mission
MAVSDK::mavsdk_telemetry
)
target_compile_options(mavsdk_tests
PRIVATE -std=c++17 -Wall -Wextra -Werror)
target_compile_options(mavsdk_tests
PRIVATE -std=c++17 -Wall -Wextra -Werror)
endif()