2014-12-31 18:32:25 -04:00
|
|
|
#!/bin/bash
|
|
|
|
# useful script to test all the different build types that we support.
|
|
|
|
# This helps when doing large merges
|
|
|
|
# Andrew Tridgell, November 2011
|
|
|
|
|
2015-11-24 18:25:53 -04:00
|
|
|
set -ex
|
2014-12-31 18:32:25 -04:00
|
|
|
|
2015-04-05 16:24:54 -03:00
|
|
|
. ~/.profile
|
|
|
|
|
2016-01-07 12:11:34 -04:00
|
|
|
# CXX and CC are exported by default by travis
|
2016-03-08 20:52:33 -04:00
|
|
|
c_compiler=${CC:-gcc}
|
|
|
|
cxx_compiler=${CXX:-g++}
|
2016-01-07 12:11:34 -04:00
|
|
|
unset CXX CC
|
|
|
|
|
2016-04-15 11:53:10 -03:00
|
|
|
export BUILDROOT=/tmp/ci.build
|
2016-01-18 21:28:04 -04:00
|
|
|
rm -rf $BUILDROOT
|
2016-04-15 11:53:10 -03:00
|
|
|
export GIT_VERSION="ci_test"
|
|
|
|
export NUTTX_GIT_VERSION="ci_test"
|
|
|
|
export PX4_GIT_VERSION="ci_test"
|
|
|
|
export CCACHE_SLOPPINESS="include_file_ctime,include_file_mtime"
|
2016-01-18 21:28:04 -04:00
|
|
|
|
2016-04-16 05:58:37 -03:00
|
|
|
if [[ "$cxx_compiler" == "clang++" ]]; then
|
|
|
|
export CCACHE_CPP2="true"
|
|
|
|
fi
|
|
|
|
|
2016-05-11 17:09:43 -03:00
|
|
|
# If CI_BUILD_TARGET is not set, build 3 different ones
|
2016-01-18 15:37:53 -04:00
|
|
|
if [ -z "$CI_BUILD_TARGET" ]; then
|
2016-05-11 17:09:43 -03:00
|
|
|
CI_BUILD_TARGET="sitl linux px4-v2"
|
2015-06-15 22:03:23 -03:00
|
|
|
fi
|
2015-06-11 19:56:15 -03:00
|
|
|
|
2016-05-17 02:16:42 -03:00
|
|
|
if [[ "$CI_BUILD_TARGET" == *"px4"* ]]; then
|
|
|
|
export CCACHE_MAXSIZE="1500M"
|
2016-05-25 14:23:36 -03:00
|
|
|
elif [[ "$CI_BUILD_TARGET" == "sitltest" ]]; then
|
|
|
|
export CCACHE_MAXSIZE="300M"
|
2016-05-17 02:16:42 -03:00
|
|
|
else
|
2016-05-25 14:23:36 -03:00
|
|
|
export CCACHE_MAXSIZE="1000M"
|
2016-05-17 02:16:42 -03:00
|
|
|
fi
|
|
|
|
|
2016-02-21 16:50:13 -04:00
|
|
|
# special case for SITL testing in CI
|
|
|
|
if [ "$CI_BUILD_TARGET" = "sitltest" ]; then
|
|
|
|
echo "Installing pymavlink"
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
(cd modules/mavlink/pymavlink && python setup.py build install --user)
|
|
|
|
unset BUILDROOT
|
|
|
|
echo "Running SITL QuadCopter test"
|
|
|
|
Tools/autotest/autotest.py -j2 build.ArduCopter fly.ArduCopter
|
|
|
|
echo "Running SITL QuadPlane test"
|
|
|
|
Tools/autotest/autotest.py -j2 build.ArduPlane fly.QuadPlane
|
2016-12-19 06:26:49 -04:00
|
|
|
echo "Running SITL Rover test"
|
|
|
|
Tools/autotest/autotest.py -j2 build.APMrover2 drive.APMrover2
|
2016-02-21 16:50:13 -04:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-05-11 17:09:43 -03:00
|
|
|
declare -A waf_supported_boards
|
|
|
|
|
2015-12-07 14:33:25 -04:00
|
|
|
waf=modules/waf/waf-light
|
|
|
|
|
2015-11-27 14:50:45 -04:00
|
|
|
# get list of boards supported by the waf build
|
2015-12-07 14:33:25 -04:00
|
|
|
for board in $($waf list_boards | head -n1); do waf_supported_boards[$board]=1; done
|
2015-11-27 14:50:45 -04:00
|
|
|
|
2016-05-24 23:32:04 -03:00
|
|
|
function get_time {
|
|
|
|
date -u "+%s"
|
|
|
|
}
|
|
|
|
|
2016-01-18 15:37:53 -04:00
|
|
|
echo "Targets: $CI_BUILD_TARGET"
|
|
|
|
for t in $CI_BUILD_TARGET; do
|
2016-05-17 11:39:24 -03:00
|
|
|
# only do make-based builds for GCC when target is PX4 or when launched by a scheduled job
|
|
|
|
if [[ "$cxx_compiler" != "clang++" && ( $t == "px4"* || -n ${CI_CRON_JOB+1} ) ]]; then
|
2016-03-08 20:52:33 -04:00
|
|
|
echo "Starting make based build for target ${t}..."
|
2016-05-11 17:09:43 -03:00
|
|
|
for v in "ArduPlane" "ArduCopter" "APMrover2" "AntennaTracker"; do
|
2016-03-08 20:52:33 -04:00
|
|
|
echo "Building $v for ${t}..."
|
|
|
|
|
|
|
|
pushd $v
|
|
|
|
make clean
|
2016-05-11 17:09:43 -03:00
|
|
|
if [[ $t == "px4"* ]]; then
|
|
|
|
make px4-cleandep
|
2016-03-08 20:52:33 -04:00
|
|
|
fi
|
|
|
|
|
2016-05-24 23:32:04 -03:00
|
|
|
start_time=$(get_time)
|
2016-05-11 17:09:43 -03:00
|
|
|
make $t -j2
|
2016-05-24 23:32:04 -03:00
|
|
|
diff_time=$(($(get_time)-$start_time))
|
|
|
|
echo -e "\033[32m'make' finished successfully (${diff_time}s)\033[0m"
|
2016-05-17 02:16:42 -03:00
|
|
|
ccache -s && ccache -z
|
2016-03-08 20:52:33 -04:00
|
|
|
popd
|
|
|
|
done
|
2016-05-11 17:09:43 -03:00
|
|
|
|
|
|
|
if [[ $t == linux ]]; then
|
|
|
|
echo "Building Replay for ${t}..."
|
|
|
|
|
|
|
|
pushd "Tools/Replay"
|
|
|
|
make clean
|
2016-09-18 23:56:42 -03:00
|
|
|
make -j2
|
2016-05-11 17:09:43 -03:00
|
|
|
popd
|
|
|
|
fi
|
2016-03-08 20:52:33 -04:00
|
|
|
fi
|
2015-11-27 14:50:45 -04:00
|
|
|
|
2016-05-17 11:39:24 -03:00
|
|
|
if [[ -n ${waf_supported_boards[$t]} && -z ${CI_CRON_JOB+1} ]]; then
|
2015-11-27 14:50:45 -04:00
|
|
|
echo "Starting waf build for board ${t}..."
|
2016-03-08 20:52:33 -04:00
|
|
|
$waf configure --board $t --enable-benchmarks --check-c-compiler="$c_compiler" --check-cxx-compiler="$cxx_compiler"
|
2015-12-07 14:33:25 -04:00
|
|
|
$waf clean
|
2016-05-17 11:39:24 -03:00
|
|
|
$waf all
|
2016-05-17 02:16:42 -03:00
|
|
|
ccache -s && ccache -z
|
|
|
|
|
2016-01-19 09:02:10 -04:00
|
|
|
if [[ $t == linux ]]; then
|
|
|
|
$waf check
|
|
|
|
fi
|
2015-11-27 14:50:45 -04:00
|
|
|
fi
|
2014-12-31 18:32:25 -04:00
|
|
|
done
|
2016-01-19 16:41:18 -04:00
|
|
|
|
|
|
|
echo build OK
|
|
|
|
exit 0
|