Jenkins SITL tests restore try to always analyze

This commit is contained in:
Daniel Agar 2018-09-02 16:32:23 -04:00
parent d7580aa676
commit d32fd27129
1 changed files with 42 additions and 34 deletions

View File

@ -206,44 +206,52 @@ def createTestNode(Map test_def) {
docker.image("px4io/px4-dev-ros:2018-08-23").inside('-e HOME=${WORKSPACE}') {
stage(test_def.name) {
sh('export')
try {
sh('export')
if (env.PX4_CMAKE_BUILD_TYPE == 'Coverage') {
checkout(scm)
unstash 'build_sitl_coverage'
}
unstash('px4_sitl_package')
sh('tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2')
sh('px4-posix_sitl_default*/px4/test/rostest_px4_run.sh ' + test_def.test + ' mission:=' + test_def.mission + ' vehicle:=' + test_def.vehicle)
if (env.PX4_CMAKE_BUILD_TYPE == 'Coverage') {
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
sh 'curl -s https://codecov.io/bash | bash -s - -F sitl_mission_${STAGE_NAME}'
// upload log to flight review (https://logs.px4.io/) with python code coverage
sh('coverage run -p px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg')
// process log data (with python code coverage)
sh('coverage run -p px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
// upload python code coverage to codecov.io
sh 'curl -s https://codecov.io/bash | bash -s - -X gcov -F sitl_python_${STAGE_NAME}'
if (env.PX4_CMAKE_BUILD_TYPE == 'Coverage') {
checkout(scm)
unstash 'build_sitl_coverage'
}
unstash('px4_sitl_package')
sh('tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2')
sh('px4-posix_sitl_default*/px4/test/rostest_px4_run.sh ' + test_def.test + ' mission:=' + test_def.mission + ' vehicle:=' + test_def.vehicle)
} catch (exc) {
// save all test artifacts for debugging
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.ulg, .ros/**/rosunit-*.xml, .ros/**/rostest-*.log')
throw (exc)
} finally {
if (env.PX4_CMAKE_BUILD_TYPE == 'Coverage') {
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
sh 'curl -s https://codecov.io/bash | bash -s - -F sitl_mission_${STAGE_NAME}'
// upload log to flight review (https://logs.px4.io/) with python code coverage
sh('coverage run -p px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg')
// process log data (with python code coverage)
sh('coverage run -p px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
// upload python code coverage to codecov.io
sh 'curl -s https://codecov.io/bash | bash -s - -X gcov -F sitl_python_${STAGE_NAME}'
}
}
// log analysis (non code coverage)
if (env.PX4_CMAKE_BUILD_TYPE != 'Coverage') {
// upload log to flight review (https://logs.px4.io/)
sh('px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg')
sh('px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
}
// save test artifacts for debugging
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv')
}
// log analysis (non code coverage)
if (env.PX4_CMAKE_BUILD_TYPE != 'Coverage') {
// upload log to flight review (https://logs.px4.io/)
sh('px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg')
sh('px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
}
// save all test artifacts for debugging
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.ulg, .ros/**/rosunit-*.xml, .ros/**/rostest-*.log')
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv')
}
}
cleanWs()