Jenkins simple mission code coverage build

This commit is contained in:
Daniel Agar 2018-05-05 16:55:36 -04:00
parent 1b5396436e
commit 5de5d6ea49
4 changed files with 31 additions and 5 deletions

18
Jenkinsfile vendored
View File

@ -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') {
agent {
docker {

View File

@ -279,7 +279,7 @@ format:
# Testing
# --------------------------------------------------------------------
.PHONY: tests tests_coverage tests_mission tests_offboard rostest
.PHONY: tests tests_coverage tests_mission tests_mission_coverage tests_offboard rostest
tests:
@$(MAKE) --no-print-directory posix_sitl_default test_results \
@ -302,6 +302,13 @@ rostest: posix_sitl_default
tests_mission: rostest
@$(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
@$(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

View File

@ -69,15 +69,15 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
message(FATAL_ERROR "genhtml required")
endif()
set(coverage_info "${CMAKE_BINARY_DIR}/coverage.info")
set(coverage_info "${CMAKE_BINARY_DIR}/${_outputname}.info")
set(coverage_cleaned "${coverage_info}.cleaned")
separate_arguments(test_command UNIX_COMMAND "${_testrunner}")
# Setup target
add_custom_COMMAND(OUTPUT ${coverage_info}
add_custom_command(OUTPUT ${coverage_info}
# Cleanup lcov
COMMAND ${LCOV_PATH} --quiet --directory . --zerocounters
#COMMAND ${LCOV_PATH} --quiet --directory . --zerocounters
# Run tests
COMMAND ${test_command} ${ARGV3}

View File

@ -95,7 +95,8 @@ add_custom_target(test_results
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
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()
add_custom_target(test_results_junit