Doc: group obsolete NMEA sentences
[marnav.git] / bin / test-buildall
blob6f6ff9843bc4d451d0c48cb81461e49e2fa002dc
1 #!/bin/bash -eu
3 # builds all relevant configurations, executes tests
5 export SCRIPT_BASE=$(dirname `readlink -f $0`)
6 export BASE=${SCRIPT_BASE}/..
7 export BUILD=${BASE}/build
9 # ask system about number of processors, accept already specified number
10 export NUM_PROC=${NUM_PROC:-$(cat /proc/cpuinfo | grep -E "^processor" | wc -l)}
13 function prepare_build_dir()
15 if [ -d ${BUILD} ] ; then
16 rm -fr ${BUILD}
18 mkdir -p ${BUILD}
21 function log_result()
23 result=$1
24 logfile=$2
25 if [ ${result} -eq 0 ] ; then
26 echo "SUCCESS" >> ${logfile}
27 echo -e " \033[32mSUCCESS\033[0m"
28 else
29 echo "FAILURE" >> ${logfile}
30 echo -e " \033[31mFAILURE\033[0m"
34 function build_with_local_installation()
36 for cfg in $(${SCRIPT_BASE}/bld --list | grep -E "clang[0-9]+|gcc[0-9]+") ; do
37 echo -n "target: ${cfg} "
38 printf '%*s' $((45 - ${#cfg})) "" | tr ' ' '.'
39 set +e
40 BUILD_DIR=${BUILD}/${cfg} ${SCRIPT_BASE}/bld ${cfg} >&${BUILD}/${cfg}.log
41 log_result $? ${BUILD}/${cfg}.log
42 set -e
43 rm -fr ${BUILD}/${cfg}
44 done
47 function build_with_docker()
49 name=marnav
50 account=mariokonrad/
52 for dockerid in $(docker images ${account}${name} | grep -Ev "REPOSITORY" | sed -E 's/^([^[:space:]]+)\s+([^[:space:]]+)\s+.*$/\1:\2/' | sort -Vur) ; do
53 for build_type in Debug Release ; do
54 cfg=$(echo "${dockerid}_${build_type}" | tr '/:' '__')
56 echo -n "target: ${cfg} "
57 printf '%*s' $((45 - ${#cfg})) "" | tr ' ' '.'
58 set +e
59 BUILD_DIR=${BUILD}/${cfg} ${SCRIPT_BASE}/docker-build.sh "$(echo ${dockerid} | sed "s@${account}${name}:@@")" ${build_type} >&${BUILD}/${cfg}.log
60 log_result $? ${BUILD}/${cfg}.log
61 set -e
62 rm -fr ${BUILD}/${cfg}
63 done
64 done
67 prepare_build_dir
68 build_with_local_installation
69 build_with_docker