mirror of https://github.com/ArduPilot/ardupilot
Tools: added the top level scripts for autotest
This commit is contained in:
parent
1d836db862
commit
3deaf0beee
|
@ -0,0 +1,120 @@
|
|||
#!/bin/bash
|
||||
|
||||
export PATH=/usr/local/bin:$HOME/prefix/bin:$HOME/APM/px4/gcc-arm-none-eabi-4_6-2012q2/bin:$PATH
|
||||
export PYTHONUNBUFFERED=1
|
||||
export PX4_ROOT=$HOME/APM/px4/PX4Firmware
|
||||
|
||||
cd $HOME/APM || exit 1
|
||||
|
||||
test -n "$FORCEBUILD" || {
|
||||
(cd APM && git fetch > /dev/null 2>&1)
|
||||
oldhash=$(cd APM && git rev-parse origin/master)
|
||||
newhash=$(cd APM && git rev-parse HEAD)
|
||||
if [ "$oldhash" = "$newhash" ]; then
|
||||
echo "no change $oldhash $newhash `date`" >> build.log
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
############################
|
||||
# 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")))
|
||||
test $LOCKAGE -gt 7200 && {
|
||||
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`
|
||||
|
||||
You can view the build logs at http://autotest.diydrones.com/
|
||||
|
||||
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)
|
||||
|
||||
pushd APM
|
||||
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
|
||||
|
||||
pushd px4/PX4Firmware
|
||||
git fetch origin
|
||||
git reset --hard origin/master
|
||||
popd
|
||||
|
||||
for d in MAVProxy pymavlink; do
|
||||
pushd $d
|
||||
git pr
|
||||
popd
|
||||
done
|
||||
|
||||
githash=$(cd APM && git rev-parse HEAD)
|
||||
hdate=$(date +"%Y-%m-%d-%H:%m")
|
||||
|
||||
for d in ArduPlane ArduCopter APMrover2; do
|
||||
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
|
||||
Tools/scripts/frame_sizes.py buildlogs/$d.build > buildlogs/$d.framesizes.txt
|
||||
(
|
||||
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"
|
||||
(cd buildlogs && cp -f *.txt *.flashlog *.mavlog *.km[lz] *.gpx *.html "history/$hdate/")
|
||||
echo $githash > "buildlogs/history/$hdate/githash.txt"
|
||||
|
||||
APM/Tools/scripts/build_parameters.sh
|
||||
|
||||
timelimit 4000 APM/Tools/autotest/autotest.py --timeout=3900 > buildlogs/autotest-output.txt 2>&1
|
||||
|
||||
) >> build.log 2>&1
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd APM
|
||||
./Tools/autotest/param_metadata/param_parse.py > param.out
|
||||
(cd ../APM.wiki && git pull --rebase)
|
||||
cmp Parameters.wiki ../APM.wiki/APM_Parameters.wiki || {
|
||||
cp Parameters.wiki ../APM.wiki/APM_Parameters.wiki
|
||||
cd ../APM.wiki
|
||||
git commit -m 'autotest updated parameters page' --author='autotest <autotest@tridgell.net>' APM_Parameters.wiki
|
||||
git push
|
||||
}
|
||||
/bin/mkdir -p ../buildlogs/Parameters
|
||||
/bin/mv *.wiki *.xml ../buildlogs/Parameters/
|
Loading…
Reference in New Issue