Skip to content

Commit

Permalink
Merge pull request #1 from PX4/master
Browse files Browse the repository at this point in the history
new version mar 2019
  • Loading branch information
francelico authored Mar 29, 2019
2 parents e91db7b + 52542f9 commit c9b62d5
Show file tree
Hide file tree
Showing 1,845 changed files with 86,677 additions and 112,106 deletions.
190 changes: 35 additions & 155 deletions .ci/Jenkinsfile-SITL_tests
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,32 @@
pipeline {
agent none

parameters {
choice(
name: 'PX4_CMAKE_BUILD_TYPE',
choices: ['RelWithDebInfo', 'Coverage', 'AddressSanitizer', 'UndefinedBehaviorSanitizer'],
description: "CMake build type"
)
}

stages {

stage('Build') {

agent {
docker {
image 'px4io/px4-dev-ros-kinetic:2018-09-11'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE --cap-add SYS_PTRACE'
image 'px4io/px4-dev-ros-kinetic:2019-03-08'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE'
}
}

stages {

stage('build px4') {
steps {
sh('export')
sh('make distclean')
sh "ccache -z"
sh "git fetch --tags"
sh('make posix_sitl_default')
sh "ccache -s"
}
}

stage('stash build for coverage') {
steps {
stash includes: 'build/**/*', name: 'build_sitl_coverage', useDefaultExcludes: false
}
when {
environment name: 'PX4_CMAKE_BUILD_TYPE', value: 'Coverage'
}
}

stage('unit tests') {
steps {
sh 'export'
sh 'make posix_sitl_default test_results_junit'
junit 'build/posix_sitl_default/JUnitTestResults.xml'
}
}

stage('build sitl_gazebo') {
steps {
sh 'export'
sh "ccache -z"
sh('make posix_sitl_default sitl_gazebo')
sh "ccache -s"
}
}

stage('package') {
steps {
sh 'export'
sh('make posix_sitl_default package')
stash(name: "px4_sitl_package", includes: "build/posix_sitl_default/*.bz2")
}
}

steps {
sh 'export'
sh 'make distclean'
sh 'ccache -z'
sh 'git fetch --tags'
sh 'make px4_sitl_default'
sh 'make px4_sitl_default sitl_gazebo'
sh 'make px4_sitl_default package'
sh 'ccache -s'
stash(name: "px4_sitl_package", includes: "build/px4_sitl_default/*.bz2")
archiveArtifacts(artifacts: "build/px4_sitl_default/*.bz2", fingerprint: true, onlyIfSuccessful: true)
}

post {
always {
sh 'make distclean'
}
}

} // stage Build

stage('ROS Tests') {
Expand Down Expand Up @@ -127,6 +79,13 @@ pipeline {
mission: "VTOL_mission_1",
vehicle: "tiltrotor"
],
[
name: "MC_avoidance",
test: "mavros_posix_test_avoidance.test",
mission: "avoidance",
vehicle: "iris_obs_avoid",
run_script: "rostest_avoidance_run.sh"
],

]

Expand All @@ -140,64 +99,11 @@ pipeline {
} // steps
} // stage ROS Tests

stage('Coverage') {
parallel {

stage('code coverage (python)') {
agent {
docker {
image 'px4io/px4-dev-base:2018-09-11'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw --cap-add SYS_PTRACE'
}
}
steps {
sh 'export'
sh 'make distclean'
sh 'make python_coverage'
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
sh 'curl -s https://codecov.io/bash | bash -s - -F python'
}

sh 'make distclean'
}

when {
environment name: 'PX4_CMAKE_BUILD_TYPE', value: 'Coverage'
}
}

stage('unit tests') {
agent {
docker {
image 'px4io/px4-dev-base:2018-09-11'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw --cap-add SYS_PTRACE'
}
}
steps {
sh 'export'
sh 'make distclean'
sh 'make posix_sitl_default test_results_junit'
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
sh 'curl -s https://codecov.io/bash | bash -s - -F unittest'
}
sh 'make distclean'
}
when {
environment name: 'PX4_CMAKE_BUILD_TYPE', value: 'Coverage'
}
}

} // parallel
} // stage Coverage

} //stages

environment {
ASAN_OPTIONS = 'detect_stack_use_after_return=1:check_initialization_order=1'
UBSAN_OPTIONS = 'print_stacktrace=1'
CCACHE_DIR = '/tmp/ccache'
CI = true
CTEST_OUTPUT_ON_FAILURE = 1
}

options {
Expand All @@ -210,22 +116,18 @@ def createTestNode(Map test_def) {
return {
node {
cleanWs()
docker.image("px4io/px4-dev-ros-kinetic:2018-09-11").inside('-e HOME=${WORKSPACE} --cap-add SYS_PTRACE') {
docker.image("px4io/px4-dev-ros-kinetic:2019-03-08").inside('-e HOME=${WORKSPACE}') {
stage(test_def.name) {
def run_script = test_def.get('run_script', 'rostest_px4_run.sh')
def test_ok = true
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('tar -xjpvf build/px4_sitl_default/px4-px4_sitl_default*.bz2')

// run test
try {
sh('px4-posix_sitl_default*/px4/test/rostest_px4_run.sh ' + test_def.test + ' mission:=' + test_def.mission + ' vehicle:=' + test_def.vehicle)
sh('px4-px4_sitl_default*/px4/test/' + run_script + ' ' + test_def.test + ' mission:=' + test_def.mission + ' vehicle:=' + test_def.vehicle)

} catch (exc) {
// save all test artifacts for debugging
Expand All @@ -234,41 +136,19 @@ def createTestNode(Map test_def) {
}

// log analysis
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}'

// process log data (with python code coverage)
try {
sh('coverage run -p px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
} catch (exc) {
// save log analysis artifacts for debugging
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv')
// FIXME: don't let the script to fail the build
// test_ok = false
}

// 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')

// upload python code coverage to codecov.io
sh 'curl -s https://codecov.io/bash | bash -s - -X gcov -F sitl_python_${STAGE_NAME}'
}
} else { // non code coverage
// process ekf log data
try {
sh('px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
} catch (exc) {
// save log analysis artifacts for debugging
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv')
// FIXME: don't let the script to fail the build
// test_ok = false
}

// 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')
// process ekf log data
try {
sh('px4-px4_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
} catch (exc) {
// save log analysis artifacts for debugging
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv')
// FIXME: don't let the script to fail the build
// test_ok = false
}

// upload log to flight review (https://logs.px4.io/)
sh('px4-px4_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')

if (!test_ok) {
error('ROS Test failed')
}
Expand Down
Loading

0 comments on commit c9b62d5

Please sign in to comment.