autotest: build all binaries for master on each commit

This commit is contained in:
Andrew Tridgell 2013-03-10 17:16:56 +11:00
parent 9487eb6c1b
commit fcfed2e81d
2 changed files with 109 additions and 0 deletions

View File

@ -76,6 +76,14 @@ def build_all():
return False return False
return True return True
def build_binaries():
'''run the build_binaries.sh script'''
print("Running build_binaries.sh")
if util.run_cmd(util.reltopdir('Tools/scripts/build_binaries.sh'), dir=util.reltopdir('.')) != 0:
print("Failed build_binaries.sh")
return False
return True
def build_examples(): def build_examples():
'''run the build_examples.sh script''' '''run the build_examples.sh script'''
print("Running build_examples.sh") print("Running build_examples.sh")
@ -142,6 +150,7 @@ import arducopter, arduplane, apmrover2
steps = [ steps = [
'prerequesites', 'prerequesites',
'build.All', 'build.All',
'build.Binaries',
'build.Examples', 'build.Examples',
'build1280.ArduPlane', 'build1280.ArduPlane',
@ -247,6 +256,9 @@ def run_step(step):
if step == 'build.All': if step == 'build.All':
return build_all() return build_all()
if step == 'build.Binaries':
return build_binaries()
if step == 'build.Examples': if step == 'build.Examples':
return build_examples() return build_examples()

97
Tools/scripts/build_binaries.sh Executable file
View File

@ -0,0 +1,97 @@
#!/bin/bash
# script to build the latest binaries for each vehicle type, ready to upload
# Andrew Tridgell, March 2013
set -e
set -x
export PATH=$PATH:/bin:/usr/bin
export TMPDIR=$PWD/build.tmp.$$
echo $TMDIR
rm -rf $TMPDIR
echo "Building in $TMPDIR"
githash=$(git rev-parse HEAD)
hdate=$(date +"%Y-%m/%Y-%m-%d-%H:%m")
mkdir -p binaries/$hdate
binaries=$PWD/../buildlogs/binaries
copyit() {
file="$1"
dir="$2"
bname=$(basename $dir)
ldir=$(dirname $(dirname $dir))/latest/$bname
mkdir -p "$dir"
/bin/cp "$file" "$dir"
mkdir -p "$ldir"
rsync "$file" "$ldir"
}
echo "Building ArduPlane binaries"
pushd ArduPlane
for b in apm1 apm2 apm1-hilsensors apm2-hilsensors; do
pwd
make clean
make $b -j4
copyit $TMPDIR/ArduPlane.build/ArduPlane.hex $binaries/Plane/$hdate/$b
done
popd
echo "Building ArduCopter binaries"
pushd ArduCopter
for b in apm1 apm2 apm1-hil apm2-hil; do
pwd
make clean
make $b -j4
copyit $TMPDIR/ArduCopter.build/ArduCopter.hex $binaries/Copter/$hdate/$b
done
popd
echo "Building APMRover2 binaries"
pushd APMrover2
for b in apm1 apm2; do
pwd
make clean
make $b -j4
copyit $TMPDIR/APMrover2.build/APMrover2.hex $binaries/Rover/$hdate/$b
done
popd
. config.mk
test -n "$PX4_ROOT" && test -d "$PX4_ROOT" && {
echo "Building ArduPlane PX4 binaries"
pushd ArduPlane
make px4-clean
make px4
copyit $PX4_ROOT/Images/px4fmu.px4 $binaries/Plane/$hdate/PX4
popd
echo "Building ArduCopter PX4 binaries"
pushd ArduCopter
make px4-clean
make px4
copyit $PX4_ROOT/Images/px4fmu.px4 $binaries/Copter/$hdate/PX4
popd
echo "Building APMrover2 PX4 binaries"
pushd APMrover2
make px4-clean
make px4
copyit $PX4_ROOT/Images/px4fmu.px4 $binaries/Rover/$hdate/PX4
popd
echo "Building PX4IO firmware"
pushd $PX4_ROOT
make clean
make configure_px4io
make
copyit $PX4_ROOT/Images/px4io.bin $binaries/PX4IO/$hdate/PX4IO
make configure_px4fmu
popd
}
rm -rf $TMPDIR
exit 0