mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 03:13:34 +08:00
Jenkins simple mission code coverage build
This commit is contained in:
Vendored
+18
@@ -225,6 +225,24 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('test mission (code coverage)') {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'px4io/px4-dev-ros:2018-03-30'
|
||||||
|
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh 'export'
|
||||||
|
sh 'make distclean; rm -rf .ros; rm -rf .gazebo'
|
||||||
|
sh 'make tests_mission_coverage'
|
||||||
|
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
|
||||||
|
sh 'curl -s https://codecov.io/bash | bash -s'
|
||||||
|
}
|
||||||
|
sh 'make distclean'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('check stack') {
|
stage('check stack') {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ format:
|
|||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
.PHONY: tests tests_coverage tests_mission tests_offboard rostest
|
.PHONY: tests tests_coverage tests_mission tests_mission_coverage tests_offboard rostest
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
@$(MAKE) --no-print-directory posix_sitl_default test_results \
|
@$(MAKE) --no-print-directory posix_sitl_default test_results \
|
||||||
@@ -302,6 +302,13 @@ rostest: posix_sitl_default
|
|||||||
tests_mission: rostest
|
tests_mission: rostest
|
||||||
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_missions.test
|
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_missions.test
|
||||||
|
|
||||||
|
tests_mission_coverage:
|
||||||
|
@$(MAKE) clean
|
||||||
|
@$(MAKE) --no-print-directory posix_sitl_default PX4_CMAKE_BUILD_TYPE=Coverage
|
||||||
|
@$(MAKE) --no-print-directory posix_sitl_default sitl_gazebo PX4_CMAKE_BUILD_TYPE=Coverage
|
||||||
|
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=vtol_new_1 vehicle:=standard_vtol
|
||||||
|
@$(MAKE) --no-print-directory posix_sitl_default generate_coverage
|
||||||
|
|
||||||
tests_offboard: rostest
|
tests_offboard: rostest
|
||||||
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_offboard_attctl.test
|
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_offboard_attctl.test
|
||||||
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test
|
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test
|
||||||
|
|||||||
@@ -69,15 +69,15 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
|
|||||||
message(FATAL_ERROR "genhtml required")
|
message(FATAL_ERROR "genhtml required")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(coverage_info "${CMAKE_BINARY_DIR}/coverage.info")
|
set(coverage_info "${CMAKE_BINARY_DIR}/${_outputname}.info")
|
||||||
set(coverage_cleaned "${coverage_info}.cleaned")
|
set(coverage_cleaned "${coverage_info}.cleaned")
|
||||||
|
|
||||||
separate_arguments(test_command UNIX_COMMAND "${_testrunner}")
|
separate_arguments(test_command UNIX_COMMAND "${_testrunner}")
|
||||||
|
|
||||||
# Setup target
|
# Setup target
|
||||||
add_custom_COMMAND(OUTPUT ${coverage_info}
|
add_custom_command(OUTPUT ${coverage_info}
|
||||||
# Cleanup lcov
|
# Cleanup lcov
|
||||||
COMMAND ${LCOV_PATH} --quiet --directory . --zerocounters
|
#COMMAND ${LCOV_PATH} --quiet --directory . --zerocounters
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
COMMAND ${test_command} ${ARGV3}
|
COMMAND ${test_command} ${ARGV3}
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ add_custom_target(test_results
|
|||||||
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL Coverage)
|
if (CMAKE_BUILD_TYPE STREQUAL Coverage)
|
||||||
setup_target_for_coverage(test_coverage "${CMAKE_CTEST_COMMAND} --output-on-failure -T Test" coverage.info)
|
setup_target_for_coverage(test_coverage "${CMAKE_CTEST_COMMAND} --output-on-failure -T Test" tests)
|
||||||
|
setup_target_for_coverage(generate_coverage "${CMAKE_COMMAND} -E echo" generic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(test_results_junit
|
add_custom_target(test_results_junit
|
||||||
|
|||||||
Reference in New Issue
Block a user