travis-ci fix coverity scan and px4_metadata (#8156)

This commit is contained in:
Daniel Agar 2017-10-20 09:20:30 -04:00 committed by GitHub
parent aa92ef3ca6
commit 136d259876
7 changed files with 104 additions and 158 deletions

12
.gitignore vendored
View File

@ -64,14 +64,10 @@ cmake-build-*/
posix-configs/SITL/init/test/*_generated posix-configs/SITL/init/test/*_generated
parameters.md /airframes.md
airframes.md /airframes.xml
airframes.xml /parameters.md
/parameters.xml
/modules /modules
cppcheck-result.xml
cppcheck
scan-build
*.gcov *.gcov

View File

@ -1,6 +1,11 @@
# Build and autotest script for PX4 Firmware # Build and autotest script for PX4 Firmware
# http://travis-ci.org # http://travis-ci.org
sudo: required
services:
- docker
language: cpp language: cpp
git: git:
@ -9,8 +14,8 @@ git:
env: env:
global: global:
# COVERITY KEY # COVERITY_SCAN_TOKEN
- secure: "NyaJoCGjU0Xc90Y6bxVYWLgjrJX5HlZsm/SPxruZ6I7xkGo19fJIFzGegOHQFR32D4AiKjllfjTUNy+ncckWplind0QwxtF4/kxXrz9XBfiby6X8jLYXIekrB6Ay0mBLGbniDdh+lpWtcyop6Dmkt5bdJCJuKY2nv9ENnhhs07M=" - secure: "Q4IAcmo1r5cr/UvhcixQa6QN5e5eTcP7FeidzEbX2+BA38yo2BH5O9YQCvZe2AI1Na8ZCjVx3H2luGgDwOKgzAIAjXjZ2KbmXYc6Ns/j/BXScY05dCCzYEhXKD98NZxIKH9lLN9pYDGRA8pChGRJnVlFOr1JHHHnB801+osHy7M="
# AWS KEY: $PX4_AWS_KEY # AWS KEY: $PX4_AWS_KEY
- secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA=" - secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA="
# AWS SECRET: $PX4_AWS_SECRET # AWS SECRET: $PX4_AWS_SECRET
@ -19,52 +24,22 @@ env:
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- os: linux - env: BUILD_TARGET=check_format
sudo: required - env: BUILD_TARGET=check_stack
services: - env: BUILD_TARGET=clang-tidy-quiet
- docker - env: BUILD_TARGET=cppcheck
env: BUILD_TARGET=check_format - env: BUILD_TARGET=px4_metadata
- os: linux - env: BUILD_TARGET=scan-build
sudo: required - env: BUILD_TARGET=tests
services: - env: BUILD_TARGET=tests PX4_ASAN=1
- docker - env: BUILD_TARGET=tests PX4_UBSAN=1
env: BUILD_TARGET=tests - env: BUILD_TARGET=tests_coverage
- os: linux - env: BUILD_TARGET=coverity_scan
sudo: required
services:
- docker
env: BUILD_TARGET=tests_asan
- os: linux
sudo: required
services:
- docker
env: BUILD_TARGET=tests_coverage
- os: linux
sudo: required
services:
- docker
env: BUILD_TARGET=clang-tidy
- os: linux
sudo: required
services:
- docker
env: BUILD_TARGET=scan-build
- os: linux
sudo: required
services:
- docker
env: BUILD_TARGET=cppcheck
- os: linux
sudo: required
services:
- docker
env: BUILD_TARGET=px4_metadata
- os: linux
dist: trusty dist: trusty
sudo: required if: branch = coverity_scan
env: BUILD_TARGET=coverity_scan
allow_failures: allow_failures:
- env: BUILD_TARGET=tests_asan - env: BUILD_TARGET=tests PX4_ASAN=1
- env: BUILD_TARGET=tests PX4_UBSAN=1
- env: BUILD_TARGET=tests_coverage - env: BUILD_TARGET=tests_coverage
cache: cache:
@ -72,70 +47,37 @@ cache:
before_install: before_install:
# install dependencies for the coverity build (target and branch), otherwise exit early # install dependencies for the coverity build (target and branch), otherwise exit early
- if [[ "${TRAVIS_BRANCH}" = "coverity" ]]; then - if [[ "${TRAVIS_BRANCH}" = "coverity_scan" ]]; then
if [[ "${BUILD_TARGET}" = "coverity_scan" ]]; then sudo apt-get install genromfs && pip install empy jinja2; else exit 0; fi; if [[ "${BUILD_TARGET}" = "coverity_scan" ]]; then
sudo apt-get install python-empy python-jinja2;
echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-;
else
exit 0;
fi
fi fi
# use git:// to fetch instead of https:// # use git:// to fetch instead of https://
- git config --global url."git://".insteadOf https:// - git config --global url."git://".insteadOf https://
script: script:
- if [[ "${BUILD_TARGET}" = "coverity_scan" ]]; then - if [[ "${BUILD_TARGET}" != "coverity_scan" ]]; then
echo "no script for coverity build"; ./Tools/docker_run.sh make ${BUILD_TARGET};
elif [[ "${TRAVIS_BRANCH}" = "coverity" ]]; then
echo "exit early for coverity build" && exit 0;
elif [[ "${BUILD_TARGET}" = "check_format" ]]; then
./Tools/docker_run.sh 'make check_format';
elif [[ "${BUILD_TARGET}" = "tests" ]]; then
./Tools/docker_run.sh 'make tests';
elif [[ "${BUILD_TARGET}" = "tests_coverage" ]]; then
./Tools/docker_run.sh 'make tests_coverage' && bash <(curl -s https://codecov.io/bash) -F unittests;
elif [[ "${BUILD_TARGET}" = "tests_asan" ]]; then
./Tools/docker_run.sh 'PX4_ASAN=1 make tests';
elif [[ "${BUILD_TARGET}" = "px4_metadata" ]]; then
./Tools/docker_run.sh 'make px4_metadata';
elif [[ "${BUILD_TARGET}" = "clang-tidy" ]]; then
./Tools/docker_run.sh 'make clang-tidy-quiet';
fi fi
after_success: after_success:
# s3 upload airframe and parameter metadata # upload metadata and static analysis to s3
- if [[ "${BUILD_TARGET}" = "px4_metadata" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
./Tools/docker_run.sh 'make s3put_metadata AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}"'; [ "${BUILD_TARGET}" = "px4_metadata" ] && ./Tools/docker_run.sh 'make s3put_metadata AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}"';
fi [ "${BUILD_TARGET}" = "scan-build" ] && ./Tools/docker_run.sh 'make s3put_scan-build AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}/scan-build"';
# s3 upload clang scan-build output for master branch [ "${BUILD_TARGET}" = "cppcheck" ] && ./Tools/docker_run.sh 'make s3put_cppcheck AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}/cppcheck"';
- if [[ "${BUILD_TARGET}" = "scan-build" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then [ "${BUILD_TARGET}" = "tests_coverage" ] && bash <(curl -s https://codecov.io/bash) -F unittests;
./Tools/docker_run.sh 'make s3put_scan-build AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}/scan-build"';
fi
# s3 upload cppcheck output for master branch
- if [[ "${BUILD_TARGET}" = "cppcheck" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
./Tools/docker_run.sh 'make s3put_cppcheck AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}/cppcheck"';
fi fi
addons: addons:
coverity_scan: coverity_scan:
project: project:
name: PX4/Firmware name: "PX4/Firmware"
description: "Build submitted via Travis CI"
notification_email: ci@px4.io notification_email: ci@px4.io
build_command: make posix_sitl_default build_command_prepend: "make distclean"
branch_pattern: coverity build_command: "make posix_sitl_default"
branch_pattern: coverity_scan
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/2b9c4a4cb2211f8befba
on_success: always # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
slack:
rooms:
- secure: "QKw73Zel/s3JAbe/7XyO9tPnJwiiGFpYzSjdR8lG3tYFjRdXZnhxG4c+G7bkgkaPTS4Hult33VXE3kcEqOI7+C+eRwRlZhDfL0knQbXVCxjcLjzmUFdoPOwurlgZDw66PFWCi5tZcLKSRo3u4U8ibT4WKi3jm9sDSyOcfBAucMU="
on_pull_requests: false
on_success: never # options: [always|never|change] default: always
on_failure: never # options: [always|never|change] default: always

View File

@ -128,7 +128,7 @@ string(REPLACE "_" ";" config_args ${CONFIG})
list(GET config_args 0 OS) list(GET config_args 0 OS)
list(GET config_args 1 BOARD) list(GET config_args 1 BOARD)
list(GET config_args 2 LABEL) list(GET config_args 2 LABEL)
set(target_name "${OS}-${BOARD}-${LABEL}") set(target_name "${OS}_${BOARD}_${LABEL}")
file(GLOB_RECURSE configs RELATIVE cmake/configs "cmake/configs/*.cmake") file(GLOB_RECURSE configs RELATIVE cmake/configs "cmake/configs/*.cmake")
set_property(CACHE CONFIG PROPERTY STRINGS ${configs}) set_property(CACHE CONFIG PROPERTY STRINGS ${configs})

View File

@ -108,8 +108,6 @@ else
endif endif
# additional config parameters passed to cmake # additional config parameters passed to cmake
CMAKE_ARGS += -Wno-deprecated
ifdef EXTERNAL_MODULES_LOCATION ifdef EXTERNAL_MODULES_LOCATION
CMAKE_ARGS += -DEXTERNAL_MODULES_LOCATION:STRING=$(EXTERNAL_MODULES_LOCATION) CMAKE_ARGS += -DEXTERNAL_MODULES_LOCATION:STRING=$(EXTERNAL_MODULES_LOCATION)
endif endif
@ -124,7 +122,7 @@ endif
define cmake-build define cmake-build
+@$(eval BUILD_DIR = $(SRC_DIR)/build/$@$(BUILD_DIR_SUFFIX)) +@$(eval BUILD_DIR = $(SRC_DIR)/build/$@$(BUILD_DIR_SUFFIX))
+@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(BUILD_DIR)/Makefile ]; then rm -rf $(BUILD_DIR); fi +@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(BUILD_DIR)/Makefile ]; then rm -rf $(BUILD_DIR); fi
+@if [ ! -e $(BUILD_DIR)/CMakeCache.txt ]; then mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && cmake $(2) -G"$(PX4_CMAKE_GENERATOR)" -DCONFIG=$(1) $(CMAKE_ARGS) || (rm -rf $(BUILD_DIR)); fi +@if [ ! -e $(BUILD_DIR)/CMakeCache.txt ]; then mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && cmake $(2) -G"$(PX4_CMAKE_GENERATOR)" $(CMAKE_ARGS) -DCONFIG=$(1) || (rm -rf $(BUILD_DIR)); fi
+@(cd $(BUILD_DIR) && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS)) +@(cd $(BUILD_DIR) && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS))
endef endef
@ -135,8 +133,8 @@ define colorecho
+@echo "${COLOR_BLUE}${1} ${NO_COLOR}" +@echo "${COLOR_BLUE}${1} ${NO_COLOR}"
endef endef
# Get a list of all config targets. # Get a list of all config targets cmake/configs/*.cmake
ALL_CONFIG_TARGETS := $(basename $(shell find "$(SRC_DIR)/cmake/configs" ! -name '*_common*' ! -name '*_sdflight_*' -name '*.cmake' -print | sed -e 's:^.*/::' | sort)) ALL_CONFIG_TARGETS := $(basename $(shell find "$(SRC_DIR)/cmake/configs" -maxdepth 1 ! -name '*_common*' ! -name '*_sdflight_*' -name '*.cmake' -print | sed -e 's:^.*/::' | sort))
# Strip off leading nuttx_ # Strip off leading nuttx_
NUTTX_CONFIG_TARGETS := $(patsubst nuttx_%,%,$(filter nuttx_%,$(ALL_CONFIG_TARGETS))) NUTTX_CONFIG_TARGETS := $(patsubst nuttx_%,%,$(filter nuttx_%,$(ALL_CONFIG_TARGETS)))
@ -176,11 +174,10 @@ excelsior_legacy_default: posix_excelsior_legacy qurt_excelsior_legacy
# Other targets # Other targets
# -------------------------------------------------------------------- # --------------------------------------------------------------------
.PHONY: qgc_firmware px4fmu_firmware misc_qgc_extra_firmware alt_firmware .PHONY: qgc_firmware px4fmu_firmware misc_qgc_extra_firmware alt_firmware check_rtps
.PHONY: sizes check quick_check check_rtps
# QGroundControl flashable NuttX firmware # QGroundControl flashable NuttX firmware
qgc_firmware: px4fmu_firmware misc_qgc_extra_firmware sizes qgc_firmware: px4fmu_firmware misc_qgc_extra_firmware
# px4fmu NuttX firmware # px4fmu NuttX firmware
px4fmu_firmware: \ px4fmu_firmware: \
@ -221,6 +218,8 @@ check_rtps: \
check_posix_sitl_rtps \ check_posix_sitl_rtps \
sizes sizes
.PHONY: sizes check quick_check check_rtps
sizes: sizes:
@-find build -name *.elf -type f | xargs size 2> /dev/null || : @-find build -name *.elf -type f | xargs size 2> /dev/null || :
@ -228,7 +227,7 @@ sizes:
check: check_posix_sitl_default px4fmu_firmware misc_qgc_extra_firmware alt_firmware tests check_format check: check_posix_sitl_default px4fmu_firmware misc_qgc_extra_firmware alt_firmware tests check_format
# quick_check builds a single nuttx and posix target, runs testing, and checks the style # quick_check builds a single nuttx and posix target, runs testing, and checks the style
quick_check: check_posix_sitl_default check_px4fmu-v3_default tests check_format quick_check: check_posix_sitl_default check_px4fmu-v4pro_default tests check_format
check_%: check_%:
@echo @echo
@ -240,8 +239,9 @@ check_%:
# -------------------------------------------------------------------- # --------------------------------------------------------------------
.PHONY: parameters_metadata airframe_metadata module_documentation px4_metadata .PHONY: parameters_metadata airframe_metadata module_documentation px4_metadata
parameters_metadata: posix_sitl_default parameters_metadata:
@python $(SRC_DIR)/Tools/px_process_params.py -s $(SRC_DIR)/src --markdown @python $(SRC_DIR)/Tools/px_process_params.py -s `find $(SRC_DIR)/src -maxdepth 3 -type d` --inject-xml $(SRC_DIR)/Tools/parameters_injected.xml --markdown
@python $(SRC_DIR)/Tools/px_process_params.py -s `find $(SRC_DIR)/src -maxdepth 3 -type d` --inject-xml $(SRC_DIR)/Tools/parameters_injected.xml --xml
airframe_metadata: airframe_metadata:
@python $(SRC_DIR)/Tools/px_process_airframes.py -v -a $(SRC_DIR)/ROMFS/px4fmu_common/init.d --markdown @python $(SRC_DIR)/Tools/px_process_airframes.py -v -a $(SRC_DIR)/ROMFS/px4fmu_common/init.d --markdown
@ -260,13 +260,6 @@ px4_metadata: parameters_metadata airframe_metadata module_documentation
# AWS_S3_BUCKET # AWS_S3_BUCKET
.PHONY: s3put_firmware s3put_qgc_firmware s3put_px4fmu_firmware s3put_misc_qgc_extra_firmware s3put_metadata s3put_scan-build s3put_cppcheck s3put_coverage .PHONY: s3put_firmware s3put_qgc_firmware s3put_px4fmu_firmware s3put_misc_qgc_extra_firmware s3put_metadata s3put_scan-build s3put_cppcheck s3put_coverage
Firmware.zip:
@rm -rf Firmware.zip
@zip --junk-paths Firmware.zip `find . -name \*.px4`
s3put_firmware: Firmware.zip
$(SRC_DIR)/Tools/s3put.sh Firmware.zip
s3put_qgc_firmware: s3put_px4fmu_firmware s3put_misc_qgc_extra_firmware s3put_qgc_firmware: s3put_px4fmu_firmware s3put_misc_qgc_extra_firmware
s3put_px4fmu_firmware: px4fmu_firmware s3put_px4fmu_firmware: px4fmu_firmware
@ -278,17 +271,17 @@ s3put_misc_qgc_extra_firmware: misc_qgc_extra_firmware
s3put_metadata: px4_metadata s3put_metadata: px4_metadata
@$(SRC_DIR)/Tools/s3put.sh airframes.md @$(SRC_DIR)/Tools/s3put.sh airframes.md
@$(SRC_DIR)/Tools/s3put.sh airframes.xml @$(SRC_DIR)/Tools/s3put.sh airframes.xml
@$(SRC_DIR)/Tools/s3put.sh build/posix_sitl_default/parameters.xml @$(SRC_DIR)/Tools/s3put.sh parameters.xml
@$(SRC_DIR)/Tools/s3put.sh parameters.md @$(SRC_DIR)/Tools/s3put.sh parameters.md
s3put_scan-build: scan-build s3put_scan-build: scan-build
@cd $(SRC_DIR) && ./Tools/s3put.sh `find build/scan-build -mindepth 1 -maxdepth 1 -type d`/ @$(SRC_DIR)/Tools/s3put.sh `find $(SRC_DIR)/build/scan-build -mindepth 1 -maxdepth 1 -type d`/
s3put_cppcheck: cppcheck s3put_cppcheck: cppcheck
@cd $(SRC_DIR) && ./Tools/s3put.sh cppcheck/ @$(SRC_DIR)/Tools/s3put.sh $(SRC_DIR)/build/cppcheck/
s3put_coverage: tests_coverage s3put_coverage: tests_coverage
@cd $(SRC_DIR) && ./Tools/s3put.sh build/posix_sitl_default/coverage-html/ @$(SRC_DIR)/Tools/s3put.sh $(SRC_DIR)/build/posix_sitl_default/coverage-html/
# Astyle # Astyle
# -------------------------------------------------------------------- # --------------------------------------------------------------------
@ -297,7 +290,7 @@ s3put_coverage: tests_coverage
check_format: check_format:
$(call colorecho,"Checking formatting with astyle") $(call colorecho,"Checking formatting with astyle")
@$(SRC_DIR)/Tools/astyle/check_code_style_all.sh @$(SRC_DIR)/Tools/astyle/check_code_style_all.sh
@git diff --check @cd $(SRC_DIR) && git diff --check
format: format:
$(call colorecho,"Formatting with astyle") $(call colorecho,"Formatting with astyle")
@ -308,19 +301,17 @@ format:
.PHONY: tests tests_coverage .PHONY: tests tests_coverage
tests: tests:
$(MAKE) --no-print-directory posix_sitl_default test_results ASAN_OPTIONS="color=always" @$(MAKE) --no-print-directory posix_sitl_default test_results \
ASAN_OPTIONS="color=always:check_initialization_order=1:detect_stack_use_after_return=1" \
UBSAN_OPTIONS="color=always"
tests_coverage: tests_coverage:
@$(MAKE) --no-print-directory posix_sitl_default test_coverage_genhtml PX4_CMAKE_BUILD_TYPE=Coverage @$(MAKE) --no-print-directory posix_sitl_default test_coverage_genhtml PX4_CMAKE_BUILD_TYPE=Coverage
@echo "Open $(SRC_DIR)/build/posix_sitl_default/coverage-html/index.html to see coverage"
# static analyzers (scan-build, clang-tidy, cppcheck) # static analyzers (scan-build, clang-tidy, cppcheck)
# -------------------------------------------------------------------- # --------------------------------------------------------------------
.PHONY: posix_sitl_default-clang scan-build clang-tidy clang-tidy-fix clang-tidy-quiet cppcheck check_stack .PHONY: scan-build posix_sitl_default-clang clang-tidy clang-tidy-fix clang-tidy-quiet cppcheck check_stack
posix_sitl_default-clang:
@mkdir -p $(SRC_DIR)/build/posix_sitl_default-clang
@cd $(SRC_DIR)/build/posix_sitl_default-clang && cmake $(SRC_DIR) -GNinja -DCONFIG=posix_sitl_default -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
@cd $(SRC_DIR)/build/posix_sitl_default-clang && ninja
scan-build: scan-build:
@export CCC_CC=clang @export CCC_CC=clang
@ -329,32 +320,38 @@ scan-build:
@cd $(SRC_DIR)/build/posix_sitl_default-scan-build && scan-build cmake $(SRC_DIR) -GNinja -DCONFIG=posix_sitl_default @cd $(SRC_DIR)/build/posix_sitl_default-scan-build && scan-build cmake $(SRC_DIR) -GNinja -DCONFIG=posix_sitl_default
@scan-build -o $(SRC_DIR)/build/scan-build cmake --build $(SRC_DIR)/build/posix_sitl_default-scan-build @scan-build -o $(SRC_DIR)/build/scan-build cmake --build $(SRC_DIR)/build/posix_sitl_default-scan-build
posix_sitl_default-clang:
@mkdir -p $(SRC_DIR)/build/posix_sitl_default-clang
@cd $(SRC_DIR)/build/posix_sitl_default-clang && cmake $(SRC_DIR) $(CMAKE_ARGS) -G"$(PX4_CMAKE_GENERATOR)" -DCONFIG=posix_sitl_default -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
@$(PX4_MAKE) -C $(SRC_DIR)/build/posix_sitl_default-clang
clang-tidy: posix_sitl_default-clang clang-tidy: posix_sitl_default-clang
@cd build/posix_sitl_default-clang && run-clang-tidy-4.0.py -header-filter=".*\.hpp" -j$(j) -p . @cd $(SRC_DIR)/build/posix_sitl_default-clang && run-clang-tidy-4.0.py -header-filter=".*\.hpp" -j$(j) -p .
# to automatically fix a single check at a time, eg modernize-redundant-void-arg # to automatically fix a single check at a time, eg modernize-redundant-void-arg
# % run-clang-tidy-4.0.py -fix -j4 -checks=-\*,modernize-redundant-void-arg -p . # % run-clang-tidy-4.0.py -fix -j4 -checks=-\*,modernize-redundant-void-arg -p .
clang-tidy-fix: posix_sitl_default-clang clang-tidy-fix: posix_sitl_default-clang
@cd build/posix_sitl_default-clang && run-clang-tidy-4.0.py -header-filter=".*\.hpp" -j$(j) -fix -p . @cd $(SRC_DIR)/build/posix_sitl_default-clang && run-clang-tidy-4.0.py -header-filter=".*\.hpp" -j$(j) -fix -p .
# modified version of run-clang-tidy.py to return error codes and only output relevant results # modified version of run-clang-tidy.py to return error codes and only output relevant results
clang-tidy-quiet: posix_sitl_default-clang clang-tidy-quiet: posix_sitl_default-clang
@cd build/posix_sitl_default-clang && $(SRC_DIR)/Tools/run-clang-tidy.py -header-filter=".*\.hpp" -j$(j) -p . @cd $(SRC_DIR)/build/posix_sitl_default-clang && $(SRC_DIR)/Tools/run-clang-tidy.py -header-filter=".*\.hpp" -j$(j) -p .
# TODO: Fix cppcheck errors then try --enable=warning,performance,portability,style,unusedFunction or --enable=all # TODO: Fix cppcheck errors then try --enable=warning,performance,portability,style,unusedFunction or --enable=all
cppcheck: posix_sitl_default cppcheck: posix_sitl_default
@cppcheck -i$(SRC_DIR)/src/examples --std=c++11 --std=c99 --std=posix --project=build/posix_sitl_default/compile_commands.json --xml-version=2 2> cppcheck-result.xml @mkdir -p $(SRC_DIR)/build/cppcheck
@cppcheck-htmlreport --source-encoding=ascii --file=cppcheck-result.xml --report-dir=cppcheck --source-dir=$(SRC_DIR)/src/ @cppcheck -i$(SRC_DIR)/src/examples --enable=performance --std=c++11 --std=c99 --std=posix --project=$(SRC_DIR)/build/posix_sitl_default/compile_commands.json --xml-version=2 2> $(SRC_DIR)/build/cppcheck/cppcheck-result.xml > /dev/null
@cppcheck-htmlreport --source-encoding=ascii --file=$(SRC_DIR)/build/cppcheck/cppcheck-result.xml --report-dir=$(SRC_DIR)/build/cppcheck --source-dir=$(SRC_DIR)/src/
check_stack: px4fmu-v3_default check_stack: px4fmu-v4pro_default
@echo "Checking worst case stack usage with checkstack.pl ..." @echo "Checking worst case stack usage with checkstack.pl ..."
@echo " " @echo " "
@echo "Top 10:" @echo "Top 10:"
@cd build/px4fmu-v3_default/ && mkdir -p stack_usage && arm-none-eabi-objdump -d nuttx_px4fmu-v3_default.elf | $(SRC_DIR)/Tools/stack_usage/checkstack.pl arm 0 > stack_usage/checkstack_output.txt 2> stack_usage/checkstack_errors.txt @cd $(SRC_DIR)/build/px4fmu-v4pro_default && mkdir -p stack_usage && arm-none-eabi-objdump -d nuttx_px4fmu-v4pro_default.elf | $(SRC_DIR)/Tools/stack_usage/checkstack.pl arm 0 > stack_usage/checkstack_output.txt 2> stack_usage/checkstack_errors.txt
@head -n 10 build/px4fmu-v3_default/stack_usage/checkstack_output.txt | c++filt @head -n 10 $(SRC_DIR)/build/px4fmu-v4pro_default/stack_usage/checkstack_output.txt | c++filt
@echo " " @echo " "
@echo "Symbols with 'main', 'thread' or 'task':" @echo "Symbols with 'main', 'thread' or 'task':"
@cat build/px4fmu-v3_default/stack_usage/checkstack_output.txt | c++filt | grep -E 'thread|main|task' @cat $(SRC_DIR)/build/px4fmu-v4pro_default/stack_usage/checkstack_output.txt | c++filt | grep -E 'thread|main|task'
# Cleanup # Cleanup
# -------------------------------------------------------------------- # --------------------------------------------------------------------
@ -387,8 +384,6 @@ distclean: submodulesclean gazeboclean
$(if $(filter $(FIRST_ARG),$@), \ $(if $(filter $(FIRST_ARG),$@), \
$(error "$@ cannot be the first argument. Use '$(MAKE) help|list_config_targets' to get a list of all possible [configuration] targets."),@#) $(error "$@ cannot be the first argument. Use '$(MAKE) help|list_config_targets' to get a list of all possible [configuration] targets."),@#)
CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~")
#help: #help:
# @echo # @echo
# @echo "Type 'make ' and hit the tab key twice to see a list of the available" # @echo "Type 'make ' and hit the tab key twice to see a list of the available"

View File

@ -59,9 +59,13 @@ docker run -it --rm -w "${SRC_DIR}" \
--env=CODECOV_TOKEN \ --env=CODECOV_TOKEN \
--env=COVERALLS_REPO_TOKEN \ --env=COVERALLS_REPO_TOKEN \
--env=LOCAL_USER_ID="$(id -u)" \ --env=LOCAL_USER_ID="$(id -u)" \
--env=PX4_ASAN \
--env=PX4_MSAN \
--env=PX4_TSAN \
--env=PX4_UBSAN \
--env=TRAVIS_BRANCH \ --env=TRAVIS_BRANCH \
--env=TRAVIS_BUILD_ID \ --env=TRAVIS_BUILD_ID \
--publish 14556:14556/udp \ --publish 14556:14556/udp \
--volume=${CCACHE_DIR}:${CCACHE_DIR}:rw \ --volume=${CCACHE_DIR}:${CCACHE_DIR}:rw \
--volume=${SRC_DIR}:${SRC_DIR}:rw \ --volume=${SRC_DIR}:${SRC_DIR}:rw \
${PX4_DOCKER_REPO} /bin/bash -c "$@" ${PX4_DOCKER_REPO} /bin/bash -c "$1 $2 $3"

View File

@ -64,10 +64,10 @@ def main():
" (default FILENAME: airframes.xml)") " (default FILENAME: airframes.xml)")
parser.add_argument("-m", "--markdown", parser.add_argument("-m", "--markdown",
nargs='?', nargs='?',
const="airframe_reference.md", const="airframes.md",
metavar="FILENAME", metavar="FILENAME",
help="Create Markdown file" help="Create Markdown file"
" (default FILENAME: airframes_reference.md)") " (default FILENAME: airframes.md)")
default_image_path = '../../assets/airframes/types' default_image_path = '../../assets/airframes/types'
parser.add_argument("-i", "--image-path", parser.add_argument("-i", "--image-path",
default=default_image_path, default=default_image_path,

View File

@ -47,7 +47,7 @@ elseif(DEFINED ENV{PX4_UBSAN})
endif() endif()
if (SANITIZE_ADDRESS) if (SANITIZE_ADDRESS)
message(STATUS "address sanitizer enabled") message(STATUS "AddressSanitizer enabled")
# environment variables # environment variables
# ASAN_OPTIONS=detect_stack_use_after_return=1 # ASAN_OPTIONS=detect_stack_use_after_return=1
@ -57,19 +57,21 @@ if (SANITIZE_ADDRESS)
-fno-omit-frame-pointer -fno-omit-frame-pointer
-fsanitize=address -fsanitize=address
#-fsanitize-address-use-after-scope #-fsanitize-address-use-after-scope
-fno-optimize-sibling-calls
) )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address" CACHE INTERNAL "" FORCE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address" CACHE INTERNAL "" FORCE)
elseif(SANITIZE_MEMORY) elseif(SANITIZE_MEMORY)
message(STATUS "thread sanitizer enabled") message(STATUS "MemorySanitizer enabled")
add_compile_options( add_compile_options(
-g3 -g3
-fsanitize=memory -fsanitize=memory
) )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory" CACHE INTERNAL "" FORCE)
elseif(SANITIZE_THREAD) elseif(SANITIZE_THREAD)
message(STATUS "thread sanitizer enabled") message(STATUS "ThreadSanitizer enabled")
add_compile_options( add_compile_options(
-g3 -g3
@ -78,21 +80,26 @@ elseif(SANITIZE_THREAD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread" CACHE INTERNAL "" FORCE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread" CACHE INTERNAL "" FORCE)
elseif(SANITIZE_UNDEFINED) elseif(SANITIZE_UNDEFINED)
message(STATUS "undefined behaviour sanitizer enabled") message(STATUS "UndefinedBehaviorSanitizer enabled")
add_compile_options( add_compile_options(
-g3 -g3
#-fsanitize=alignment #-fsanitize=alignment
-fsanitize=bool -fsanitize=bool
#-fsanitize=builtin
-fsanitize=bounds -fsanitize=bounds
-fsanitize=enum -fsanitize=enum
#-fsanitize=float-cast-overflow -fsanitize=float-cast-overflow
-fsanitize=float-divide-by-zero -fsanitize=float-divide-by-zero
#-fsanitize=function #-fsanitize=function
-fsanitize=integer-divide-by-zero -fsanitize=integer-divide-by-zero
-fsanitize=nonnull-attribute -fsanitize=nonnull-attribute
-fsanitize=null -fsanitize=null
#-fsanitize=nullability-arg
#-fsanitize=nullability-assign
#-fsanitize=nullability-return
-fsanitize=object-size -fsanitize=object-size
#-fsanitize=pointer-overflow
-fsanitize=return -fsanitize=return
-fsanitize=returns-nonnull-attribute -fsanitize=returns-nonnull-attribute
-fsanitize=shift -fsanitize=shift
@ -101,6 +108,8 @@ elseif(SANITIZE_UNDEFINED)
#-fsanitize=unsigned-integer-overflow #-fsanitize=unsigned-integer-overflow
-fsanitize=vla-bound -fsanitize=vla-bound
-fsanitize=vptr -fsanitize=vptr
-fno-sanitize-recover=bounds,null
) )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined" CACHE INTERNAL "" FORCE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined" CACHE INTERNAL "" FORCE)