Permalink
Browse files

docker run helper script (#6270)

  • Loading branch information...
1 parent 7df3b4a commit defaf7f5e5cb9de95e14f05da313bd9a632a3b7b @dagar dagar committed on GitHub Jan 8, 2017
Showing with 31 additions and 25 deletions.
  1. +2 −4 .travis.yml
  2. +12 −16 Makefile
  3. +15 −0 Tools/docker_run.sh
  4. +2 −5 circle.yml
View
@@ -11,7 +11,7 @@ matrix:
include:
- os: linux
sudo: required
- env: GCC_VER=5.4 DOCKER_REPO="px4io/px4-dev-nuttx:2017-01-01"
+ env: GCC_VER=5.4
services:
- docker
- os: osx
@@ -30,7 +30,6 @@ before_install:
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
cd ${TRAVIS_BUILD_DIR}
&& git fetch --unshallow && git fetch --all --tags
- && docker pull ${DOCKER_REPO}
;
elif [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" == "coverity" ]]; then
sudo apt-get install genromfs
@@ -66,12 +65,11 @@ env:
# AWS SECRET: $PX4_AWS_SECRET
- secure: "h6oajlW68dWIr+wZhO58Dv6e68dZHrBLVA6lPXZmheFQBW6Xam1HuLGA0LOW6cL9TnrAsOZ8g4goB58eMQnMEijFZKi3mhRwZhd/Xjq/ZGJOWBUrLoQHZUw2dQk5ja5vmUlKEoQnFZjDuMjx8KfX5ZMNy8A3yssWZtJYHD8c+bk="
- PX4_AWS_BUCKET=px4-travis
- - GIT_SUBMODULES_ARE_EVIL=1
script:
- ccache -M 1GB; ccache -z
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
- PX4_DOCKER=1 make check_qgc_firmware;
+ ./Tools/docker_run.sh 'GIT_SUBMODULES_ARE_EVIL=1 make qgc_firmware';
elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
make tests;
fi
View
@@ -122,9 +122,9 @@ endif
define cmake-build
+@$(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 [ ! -e $(BUILD_DIR)/CMakeCache.txt ]; then mkdir -p $(BUILD_DIR) && $(call PX4_RUN, 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)" -DCONFIG=$(1) $(CMAKE_ARGS) || (rm -rf $(BUILD_DIR)); fi
+@echo "PX4 CONFIG: $(BUILD_DIR)"
-+@$(call PX4_RUN,$(PX4_MAKE) -C "$(BUILD_DIR)" $(PX4_MAKE_ARGS) $(ARGS))
++@$(PX4_MAKE) -C "$(BUILD_DIR)" $(PX4_MAKE_ARGS) $(ARGS)
endef
define colorecho
@@ -279,23 +279,19 @@ unittest: posix_sitl_default
@(cd build_unittest && ctest -j2 --output-on-failure)
run_tests_posix:
- @$(call PX4_RUN,$(MAKE) --no-print-directory posix_sitl_default test_results)
+ $(MAKE) --no-print-directory posix_sitl_default test_results
-tests: run_tests_posix
- @$(call PX4_RUN,$(MAKE) --no-print-directory unittest)
+tests: unittest run_tests_posix
tests_coverage:
- @$(call PX4_RUN,lcov --zerocounters --directory $(SRC_DIR) --quiet)
- @$(call PX4_RUN,lcov --capture --initial --directory $(SRC_DIR) --quiet --output-file coverage.info)
- @$(call PX4_RUN,$(MAKE) --no-print-directory unittest PX4_CODE_COVERAGE=1 CCACHE_DISABLE=1 HEADLESS=1)
- @$(call PX4_RUN,$(MAKE) --no-print-directory posix_sitl_default test_results PX4_CODE_COVERAGE=1 CCACHE_DISABLE=1 HEADLESS=1)
- @$(call PX4_RUN,lcov --no-checksum --directory $(SRC_DIR) --capture --quiet --output-file coverage.info)
- @$(call PX4_RUN,lcov --remove coverage.info '/usr/*' 'unittests/googletest/*' --quiet --output-file coverage.info)
- @$(call PX4_RUN,genhtml --legend --show-details --function-coverage --quiet --output-directory coverage-html coverage.info)
- @$(call PX4_RUN,$(MAKE) --no-print-directory posix_sitl_default test_results_junit)
-
-test_startup_shutdown:
- @$(call PX4_RUN,$(MAKE) --no-print-directory posix_sitl_test gazebo_standard_vtol HEADLESS=1 MEMORY_DEBUG=1)
+ @lcov --zerocounters --directory $(SRC_DIR) --quiet
+ @lcov --capture --initial --directory $(SRC_DIR) --quiet --output-file coverage.info
+ @$(MAKE) --no-print-directory unittest PX4_CODE_COVERAGE=1 CCACHE_DISABLE=1
+ @$(MAKE) --no-print-directory posix_sitl_default test_results PX4_CODE_COVERAGE=1 CCACHE_DISABLE=1
+ @lcov --no-checksum --directory $(SRC_DIR) --capture --quiet --output-file coverage.info
+ @lcov --remove coverage.info '/usr/*' 'unittests/googletest/*' --quiet --output-file coverage.info
+ @genhtml --legend --show-details --function-coverage --quiet --output-directory coverage-html coverage.info
+ @$(MAKE) --no-print-directory posix_sitl_default test_results_junit
scan-build:
@export CCACHE_DISABLE=1
View
@@ -0,0 +1,15 @@
+#! /bin/bash
+
+PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+SRC_DIR=$PWD/../
+
+CCACHE_DIR=${HOME}/.ccache
+mkdir -p ${CCACHE_DIR}
+
+docker run -it --rm -w ${SRC_DIR} \
+ -v ${SRC_DIR}:${SRC_DIR}:rw \
+ -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
+ -v ${CCACHE_DIR}:${CCACHE_DIR}:rw \
+ -e CCACHE_DIR=${CCACHE_DIR} \
+ -e LOCAL_USER_ID=`id -u` \
+ px4io/px4-dev-nuttx:2017-01-07 /bin/bash -c "$@"
View
@@ -14,15 +14,12 @@ dependencies:
pre:
- sudo pip install cpp-coveralls
- sudo apt-get install -y lcov
- - gem install coveralls-lcov
test:
override:
- - mkdir -p ~/.ccache
- - make distclean
- - PX4_DOCKER=1 make tests
+ - ./Tools/docker_run.sh 'make tests'
# copy test results for circleci
#- mkdir -p $CIRCLE_TEST_REPORTS/junit/ && cp ./build_posix_sitl_default/JUnitTestResults.xml build_unittest/test_detail.xml $CIRCLE_TEST_REPORTS/junit/
#- mkdir -p $CIRCLE_ARTIFACTS && cp -R coverage-html $CIRCLE_ARTIFACTS
# only post to coveralls if not a fork PR
- #- if [ -z ${CIRCLE_PR_USERNAME}]; then cpp-coveralls -l coverage.info; fi
+ #- if [ -z ${CIRCLE_PR_USERNAME}]; then ./Tools/docker_run.sh 'cpp-coveralls -l coverage.info'; fi

0 comments on commit defaf7f

Please sign in to comment.