Skip to content
Snippets Groups Projects
Commit 5de5d6ea authored by Daniel Agar's avatar Daniel Agar
Browse files

Jenkins simple mission code coverage build

parent 1b539643
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
......@@ -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
......
......@@ -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}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment