2013-03-18 01:15:50 -03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-10-20 01:28:13 -03:00
|
|
|
export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/prefix/bin:$HOME/APM/px4/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH
|
2013-03-18 01:15:50 -03:00
|
|
|
export PYTHONUNBUFFERED=1
|
2013-06-18 04:01:31 -03:00
|
|
|
export PYTHONPATH=$HOME/APM
|
2013-03-18 01:15:50 -03:00
|
|
|
|
|
|
|
cd $HOME/APM || exit 1
|
|
|
|
|
|
|
|
test -n "$FORCEBUILD" || {
|
|
|
|
(cd APM && git fetch > /dev/null 2>&1)
|
2014-01-20 04:54:35 -04:00
|
|
|
|
2013-03-29 06:00:42 -03:00
|
|
|
newtags=$(cd APM && git fetch --tags | wc -l)
|
2013-03-18 01:15:50 -03:00
|
|
|
oldhash=$(cd APM && git rev-parse origin/master)
|
|
|
|
newhash=$(cd APM && git rev-parse HEAD)
|
2014-01-20 04:54:35 -04:00
|
|
|
|
2016-03-31 19:44:33 -03:00
|
|
|
if [ "$oldhash" = "$newhash" -a "$newtags" = "0" ]; then
|
|
|
|
echo "$(date) no change $oldhash $newhash" >> build.log
|
2013-03-18 01:15:50 -03:00
|
|
|
exit 0
|
|
|
|
fi
|
2016-03-31 19:44:33 -03:00
|
|
|
echo "$(date) Build triggered $oldhash $newhash $newtags" >> build.log
|
2013-03-18 01:15:50 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
############################
|
|
|
|
# grab a lock file. Not atomic, but close :)
|
|
|
|
# tries to cope with NFS
|
|
|
|
lock_file() {
|
|
|
|
lck="$1"
|
|
|
|
pid=`cat "$lck" 2> /dev/null`
|
|
|
|
|
|
|
|
if test -f "$lck" && kill -0 $pid 2> /dev/null; then
|
|
|
|
LOCKAGE=$(($(date +%s) - $(stat -c '%Y' "build.lck")))
|
2016-03-26 05:28:04 -03:00
|
|
|
test $LOCKAGE -gt 60000 && {
|
2013-03-18 01:15:50 -03:00
|
|
|
echo "old lock file $lck is valid for $pid with age $LOCKAGE seconds"
|
|
|
|
}
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
/bin/rm -f "$lck"
|
|
|
|
echo "$$" > "$lck"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lock_file build.lck || {
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ulimit -m 500000
|
|
|
|
#ulimit -s 500000
|
|
|
|
#ulimit -t 1800
|
|
|
|
#ulimit -v 500000
|
|
|
|
|
|
|
|
(
|
|
|
|
date
|
|
|
|
|
|
|
|
report() {
|
|
|
|
d="$1"
|
|
|
|
old="$2"
|
|
|
|
new="$3"
|
|
|
|
cat <<EOF | mail -s 'build failed' drones-discuss@googlegroups.com
|
|
|
|
A build of $d failed at `date`
|
|
|
|
|
2016-03-25 02:46:11 -03:00
|
|
|
You can view the build logs at http://autotest.ardupilot.org/
|
2013-03-18 01:15:50 -03:00
|
|
|
|
|
|
|
A log of the commits since the last attempted build is below
|
|
|
|
|
|
|
|
`git log $old $new`
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
report_pull_failure() {
|
|
|
|
d="$1"
|
|
|
|
git show origin/master | mail -s 'APM pull failed' drones-discuss@googlegroups.com
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
oldhash=$(cd APM && git rev-parse HEAD)
|
|
|
|
|
2016-03-05 22:41:50 -04:00
|
|
|
echo "Updating APM"
|
2013-03-18 01:15:50 -03:00
|
|
|
pushd APM
|
2015-08-26 23:03:14 -03:00
|
|
|
git checkout -f master
|
|
|
|
git fetch origin
|
2016-09-18 19:44:32 -03:00
|
|
|
git submodule update --recursive --force
|
2015-08-26 23:03:14 -03:00
|
|
|
git reset --hard origin/master
|
2013-03-18 01:15:50 -03:00
|
|
|
git pull || report_pull_failure
|
|
|
|
git clean -f -f -x -d -d
|
|
|
|
git tag autotest-$(date '+%Y-%m-%d-%H%M%S') -m "test tag `date`"
|
|
|
|
cp ../config.mk .
|
|
|
|
popd
|
|
|
|
|
2013-03-23 02:19:23 -03:00
|
|
|
rsync -a APM/Tools/autotest/web-firmware/ buildlogs/binaries/
|
|
|
|
|
2013-07-16 00:23:48 -03:00
|
|
|
echo "Updating pymavlink"
|
2016-09-18 19:44:32 -03:00
|
|
|
pushd APM/mavlink/pymavlink
|
2013-09-05 22:46:19 -03:00
|
|
|
git show
|
2013-07-16 00:23:48 -03:00
|
|
|
python setup.py build install --user
|
|
|
|
popd
|
|
|
|
|
|
|
|
echo "Updating MAVProxy"
|
|
|
|
pushd MAVProxy
|
2013-09-05 22:46:19 -03:00
|
|
|
git fetch origin
|
|
|
|
git reset --hard origin/master
|
|
|
|
git show
|
2013-07-16 00:23:48 -03:00
|
|
|
python setup.py build install --user
|
|
|
|
popd
|
2013-03-18 01:15:50 -03:00
|
|
|
|
|
|
|
githash=$(cd APM && git rev-parse HEAD)
|
|
|
|
hdate=$(date +"%Y-%m-%d-%H:%m")
|
|
|
|
|
2015-09-15 19:03:58 -03:00
|
|
|
for d in ArduPlane ArduCopter APMrover2 AntennaTracker; do
|
2013-03-18 01:15:50 -03:00
|
|
|
pushd APM/$d
|
|
|
|
rm -rf ../../buildlogs/$d.build
|
|
|
|
(date && TMPDIR=../../buildlogs make) > ../../buildlogs/$d.txt 2>&1
|
|
|
|
status=$?
|
|
|
|
if [ $status != 0 ]; then
|
|
|
|
report $d $oldhash $newhash
|
|
|
|
fi
|
|
|
|
popd
|
2013-03-18 03:47:26 -03:00
|
|
|
APM/Tools/scripts/frame_sizes.py buildlogs/$d.build > buildlogs/$d.framesizes.txt
|
2013-03-18 01:15:50 -03:00
|
|
|
(
|
|
|
|
avr-size buildlogs/$d.build/$d.elf
|
|
|
|
avr-nm --size-sort --print-size -C buildlogs/$d.build/$d.elf
|
|
|
|
) > buildlogs/$d.sizes.txt
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p "buildlogs/history/$hdate"
|
2014-11-13 02:27:02 -04:00
|
|
|
(cd buildlogs && cp -f *.txt *.flashlog *.tlog *.km[lz] *.gpx *.html *.png *.bin *.BIN *.elf "history/$hdate/")
|
2013-03-18 01:15:50 -03:00
|
|
|
echo $githash > "buildlogs/history/$hdate/githash.txt"
|
|
|
|
|
2013-05-29 23:19:50 -03:00
|
|
|
(cd APM && Tools/scripts/build_parameters.sh)
|
2013-03-18 01:15:50 -03:00
|
|
|
|
2013-08-14 19:58:56 -03:00
|
|
|
(cd APM && Tools/scripts/build_docs.sh)
|
|
|
|
|
2013-09-13 00:22:00 -03:00
|
|
|
killall -9 JSBSim || /bin/true
|
|
|
|
|
2017-01-29 23:01:43 -04:00
|
|
|
# setup for libiio on Parrot boards
|
|
|
|
export PKG_CONFIG_PATH=$HOME/APM/ParrotLib/lib
|
|
|
|
|
2014-11-13 02:27:02 -04:00
|
|
|
# raise core limit
|
|
|
|
ulimit -c 10000000
|
|
|
|
|
2016-04-01 17:47:16 -03:00
|
|
|
timelimit 32000 APM/Tools/autotest/autotest.py --timeout=30000 > buildlogs/autotest-output.txt 2>&1
|
2013-03-18 01:15:50 -03:00
|
|
|
|
|
|
|
) >> build.log 2>&1
|
2016-10-31 05:51:51 -03:00
|
|
|
|
|
|
|
# autotest done, let's mark GTD flags
|
|
|
|
touch /tmp/.autotest.done
|
|
|
|
|