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-04-05 16:24:54 -03:00
|
|
|
. ~/.profile
|
|
|
|
|
2017-07-17 11:03:30 -03:00
|
|
|
set -ex
|
|
|
|
|
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"
|
2018-06-12 00:33:42 -03:00
|
|
|
export CHIBIOS_GIT_VERSION="ci_test"
|
2016-04-15 11:53:10 -03:00
|
|
|
export CCACHE_SLOPPINESS="include_file_ctime,include_file_mtime"
|
2018-09-19 13:03:45 -03:00
|
|
|
autotest_args=""
|
2016-01-18 21:28:04 -04:00
|
|
|
|
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
|
2018-11-20 06:25:55 -04:00
|
|
|
CI_BUILD_TARGET="sitl linux"
|
2015-06-15 22:03:23 -03:00
|
|
|
fi
|
2015-06-11 19:56:15 -03:00
|
|
|
|
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"
|
2018-09-19 13:03:45 -03:00
|
|
|
echo "Compiler: $c_compiler"
|
|
|
|
|
2018-10-03 02:20:17 -03:00
|
|
|
pymavlink_installed=0
|
2018-09-19 13:03:45 -03:00
|
|
|
|
2018-10-03 02:20:17 -03:00
|
|
|
function run_autotest() {
|
|
|
|
NAME="$1"
|
|
|
|
BVEHICLE="$2"
|
|
|
|
RVEHICLE="$3"
|
|
|
|
|
2018-10-04 05:44:12 -03:00
|
|
|
if [ $pymavlink_installed -eq 0 ]; then
|
2018-01-22 21:33:52 -04:00
|
|
|
echo "Installing pymavlink"
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
(cd modules/mavlink/pymavlink && python setup.py build install --user)
|
2018-10-03 02:20:17 -03:00
|
|
|
pymavlink_installed=1
|
|
|
|
fi
|
|
|
|
unset BUILDROOT
|
|
|
|
echo "Running SITL $NAME test"
|
|
|
|
|
2018-10-09 07:06:36 -03:00
|
|
|
w=""
|
2018-10-03 02:20:17 -03:00
|
|
|
if [ $c_compiler == "clang" ]; then
|
2018-10-09 07:06:36 -03:00
|
|
|
w="$w --check-c-compiler=clang --check-cxx-compiler=clang++"
|
|
|
|
fi
|
|
|
|
if [ $NAME == "Rover" ]; then
|
|
|
|
w="$w --enable-math-check-indexes"
|
2018-10-03 02:20:17 -03:00
|
|
|
fi
|
|
|
|
Tools/autotest/autotest.py --waf-configure-args="$w" "$BVEHICLE" "$RVEHICLE"
|
|
|
|
ccache -s && ccache -z
|
|
|
|
}
|
|
|
|
|
|
|
|
for t in $CI_BUILD_TARGET; do
|
|
|
|
# special case for SITL testing in CI
|
2018-10-04 05:54:17 -03:00
|
|
|
if [ "$t" == "sitltest-copter" ]; then
|
2018-10-03 02:20:17 -03:00
|
|
|
run_autotest "Copter" "build.ArduCopter" "fly.ArduCopter"
|
2018-01-22 21:33:52 -04:00
|
|
|
continue
|
|
|
|
fi
|
2018-10-04 05:54:17 -03:00
|
|
|
if [ "$t" == "sitltest-plane" ]; then
|
2018-10-03 02:20:17 -03:00
|
|
|
run_autotest "Plane" "build.ArduPlane" "fly.ArduPlane"
|
2018-04-10 19:43:39 -03:00
|
|
|
continue
|
|
|
|
fi
|
2018-10-04 05:54:17 -03:00
|
|
|
if [ "$t" == "sitltest-quadplane" ]; then
|
2018-10-03 02:20:17 -03:00
|
|
|
run_autotest "QuadPlane" "build.ArduPlane" "fly.QuadPlane"
|
2018-01-22 21:33:52 -04:00
|
|
|
continue
|
|
|
|
fi
|
2018-10-04 05:54:17 -03:00
|
|
|
if [ "$t" == "sitltest-rover" ]; then
|
2018-10-03 02:20:17 -03:00
|
|
|
run_autotest "Rover" "build.APMrover2" "drive.APMrover2"
|
2018-01-22 21:33:52 -04:00
|
|
|
continue
|
|
|
|
fi
|
2018-10-23 14:55:58 -03:00
|
|
|
if [ "$t" == "sitltest-sub" ]; then
|
|
|
|
run_autotest "Sub" "build.ArduSub" "dive.ArduSub"
|
|
|
|
continue
|
|
|
|
fi
|
2018-01-22 21:33:52 -04:00
|
|
|
|
2018-10-04 05:54:17 -03:00
|
|
|
if [ "$t" == "revo-bootloader" ]; then
|
2018-06-22 23:06:15 -03:00
|
|
|
echo "Building revo bootloader"
|
|
|
|
$waf configure --board revo-mini --bootloader
|
|
|
|
$waf clean
|
|
|
|
$waf bootloader
|
|
|
|
continue
|
|
|
|
fi
|
2018-06-23 18:43:24 -03:00
|
|
|
|
2018-10-04 05:54:17 -03:00
|
|
|
if [ "$t" == "iofirmware" ]; then
|
2018-09-14 07:12:01 -03:00
|
|
|
echo "Building iofirmware"
|
|
|
|
$waf configure --board iomcu
|
|
|
|
$waf clean
|
|
|
|
$waf iofirmware
|
|
|
|
continue
|
|
|
|
fi
|
2019-01-05 10:22:11 -04:00
|
|
|
|
2018-10-04 05:54:17 -03:00
|
|
|
if [ "$t" == "revo-mini" ]; then
|
2018-06-23 18:43:24 -03:00
|
|
|
# save some time by only building one target for revo-mini
|
|
|
|
echo "Building revo-mini"
|
|
|
|
$waf configure --board revo-mini
|
|
|
|
$waf clean
|
|
|
|
$waf plane
|
|
|
|
continue
|
|
|
|
fi
|
2019-01-05 10:22:11 -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}..."
|
2018-10-04 05:54:17 -03:00
|
|
|
$waf configure --board "$t" \
|
2018-03-28 01:04:48 -03:00
|
|
|
--enable-benchmarks \
|
|
|
|
--enable-header-checks \
|
|
|
|
--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
|
|
|
|
2018-06-01 22:56:07 -03:00
|
|
|
python Tools/autotest/param_metadata/param_parse.py --no-emit --vehicle APMrover2
|
|
|
|
python Tools/autotest/param_metadata/param_parse.py --no-emit --vehicle AntennaTracker
|
|
|
|
python Tools/autotest/param_metadata/param_parse.py --no-emit --vehicle ArduCopter
|
|
|
|
python Tools/autotest/param_metadata/param_parse.py --no-emit --vehicle ArduPlane
|
|
|
|
python Tools/autotest/param_metadata/param_parse.py --no-emit --vehicle ArduSub
|
|
|
|
|
2016-01-19 16:41:18 -04:00
|
|
|
echo build OK
|
|
|
|
exit 0
|