Add TXRSSI and TXLQI sensors to FrSky D8/D16/LBT when using MULTI (#7128)
[opentx.git] / tools / commit-tests.sh
blob9e470343cddf0a7c020a49333c91296798366116
1 #!/bin/bash
3 # Stops on first error, echo on
4 set -e
5 set -x
7 # Allow variable core usage, default uses all cpu cores, to set 8 cores for example : commit-tests.sh -j8
8 num_cpus=$(grep 'physical id' /proc/cpuinfo | sort -u | wc -l)
9 : "${CORES:=$num_cpus}"
10 # Default build treats warnings as errors, set -Wno-error to override, e.g.: commit-tests.sh -Wno-error
11 : "${WERROR:=1}"
12 # A board name to build for, or ALL
13 : "${FLAVOR:=ALL}"
15 for i in "$@"
17 case $i in
18 --jobs=*)
19 CORES="${i#*=}"
20 shift
22 -j*)
23 CORES="${i#*j}"
24 shift
26 -Wno-error)
27 WERROR=0
28 shift
30 -b*)
31 FLAVOR="${i#*b}"
32 shift
34 esac
35 done
37 if [ "$(uname)" = "Darwin" ]; then
38 SCRIPT=$(python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$0")
39 else
40 SCRIPT=$(readlink -f "$0")
43 if [[ -n ${GCC_ARM} ]] ; then
44 export PATH=${GCC_ARM}:$PATH
47 : ${SRCDIR:=$(dirname "$SCRIPT")/..}
49 : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=Debug -DTRACE_SIMPGMSPACE=NO -DVERBOSE_CMAKELISTS=YES -DCMAKE_RULE_MESSAGES=OFF -Wno-dev"}
50 if (( $WERROR )); then COMMON_OPTIONS+=" -DWARNINGS_AS_ERRORS=YES -DMULTIMODULE=YES"; fi
52 : ${EXTRA_OPTIONS:="$EXTRA_OPTIONS"}
54 COMMON_OPTIONS+=${EXTRA_OPTIONS}
56 : ${FIRMARE_TARGET:="firmware-size"}
58 mkdir build || true
59 cd build
61 if [[ " SKY9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then
62 # OpenTX on Sky9x
63 rm -rf ./*
64 cmake "${COMMON_OPTIONS}" -DPCB=SKY9X -DHELI=YES DLUA=YES -DTELEMETRY=FRSKY -DPPM_LIMITS_SYMETRICAL=YES -DVARIO=YES -DAUTOSWITCH=YES -DAUTOSOURCE=YES -DAUDIO=YES -DGPS=YES -DPPM_CENTER_ADJUSTABLE=YES -DFLIGHT_MODES=YES -DOVERRIDE_CHANNEL_FUNCTION=YES -DFRSKY_STICKS=YES -DGVARS=YES "${SRCDIR}"
65 make -j"${CORES}" ${FIRMARE_TARGET}
66 make -j"${CORES}" libsimulator
67 make -j"${CORES}" tests-radio
70 if [[ " AR9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then
71 # OpenTX on AR9X
72 rm -rf ./*
73 cmake "${COMMON_OPTIONS}" -DPCB=AR9X -DHELI=YES -DGVARS=YES "${SRCDIR}"
74 make -j"${CORES}" ${FIRMARE_TARGET}
75 make -j"${CORES}" libsimulator
76 make -j"${CORES}" tests-radio
79 if [[ " 9XRPRO ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then
80 # OpenTX on Sky9x
81 rm -rf ./*
82 cmake "${COMMON_OPTIONS}" -DPCB=9XRPRO -DHELI=YES -DGVARS=YES "${SRCDIR}"
83 make -j"${CORES}" ${FIRMARE_TARGET}
84 make -j"${CORES}" libsimulator
85 make -j"${CORES}" tests-radio
88 if [[ " X9LITE ALL " =~ \ ${FLAVOR}\ ]] ; then
89 # OpenTX on X9LITE
90 rm -rf ./*
91 cmake "${COMMON_OPTIONS}" -DPCB=X9LITE -DHELI=YES -DGVARS=YES "${SRCDIR}"
92 make -j"${CORES}" ${FIRMARE_TARGET}
93 make -j"${CORES}" libsimulator
94 make -j"${CORES}" tests-radio
97 if [[ " X9LITES X9LITE ALL " =~ \ ${FLAVOR}\ ]] ; then
98 # OpenTX on X9LITES
99 rm -rf ./*
100 cmake "${COMMON_OPTIONS}" -DPCB=X9LITES -DHELI=YES -DGVARS=YES "${SRCDIR}"
101 make -j"${CORES}" ${FIRMARE_TARGET}
102 make -j"${CORES}" libsimulator
103 make -j"${CORES}" tests-radio
106 if [[ " X7 ALL " =~ \ ${FLAVOR}\ ]] ; then
107 # OpenTX on X7
108 rm -rf ./*
109 cmake "${COMMON_OPTIONS}" -DPCB=X7 -DHELI=YES -DGVARS=YES "${SRCDIR}"
110 make -j"${CORES}" ${FIRMARE_TARGET}
111 make -j"${CORES}" libsimulator
112 make -j"${CORES}" tests-radio
115 if [[ " T12 X7 ALL " =~ \ ${FLAVOR}\ ]] ; then
116 # OpenTX on T12
117 rm -rf ./*
118 cmake "${COMMON_OPTIONS}" -DPCB=X7 -DPCBREV=T12 -DHELI=YES -DGVARS=YES "${SRCDIR}"
119 make -j"${CORES}" ${FIRMARE_TARGET}
120 make -j"${CORES}" libsimulator
121 make -j"${CORES}" tests-radio
124 if [[ " XLITE ALL " =~ \ ${FLAVOR}\ ]] ; then
125 # OpenTX on X-Lite
126 rm -rf ./*
127 cmake "${COMMON_OPTIONS}" -DPCB=XLITE -DHELI=YES -DGVARS=YES "${SRCDIR}"
128 make -j"${CORES}" ${FIRMARE_TARGET}
129 make -j"${CORES}" libsimulator
130 make -j"${CORES}" tests-radio
133 if [[ " XLITES XLITE ALL " =~ \ ${FLAVOR}\ ]] ; then
134 # OpenTX on X-Lites
135 rm -rf ./*
136 cmake "${COMMON_OPTIONS}" -DPCB=XLITES -DHELI=YES -DGVARS=YES "${SRCDIR}"
137 make -j"${CORES}" ${FIRMARE_TARGET}
138 make -j"${CORES}" libsimulator
139 make -j"${CORES}" tests-radio
142 if [[ " X9D X9 ALL " =~ \ ${FLAVOR}\ ]] ; then
143 # OpenTX on X9D
144 rm -rf ./*
145 cmake "${COMMON_OPTIONS}" -DPCB=X9D -DHELI=YES -DLUA=YES -DGVARS=YES "${SRCDIR}"
146 make -j"${CORES}" ${FIRMARE_TARGET}
147 make -j"${CORES}" libsimulator
148 make -j"${CORES}" tests-radio
151 if [[ " X9D+ X9 ALL " =~ \ ${FLAVOR}\ ]] ; then
152 # OpenTX on X9D+
153 rm -rf ./*
154 cmake "${COMMON_OPTIONS}" -DPCB=X9D+ -DHELI=YES -DLUA=YES -DGVARS=YES "${SRCDIR}"
155 make -j"${CORES}" ${FIRMARE_TARGET}
156 make -j"${CORES}" libsimulator
157 make -j"${CORES}" tests-radio
160 if [[ " X9D+2019 X9 ALL " =~ \ ${FLAVOR}\ ]] ; then
161 # OpenTX on X9D+ 2019
162 rm -rf ./*
163 cmake "${COMMON_OPTIONS}" -DPCB=X9D+ -DPCBREV=2019 -DHELI=YES -DLUA=YES -DGVARS=YES "${SRCDIR}"
164 make -j"${CORES}" ${FIRMARE_TARGET}
165 make -j"${CORES}" libsimulator
166 make -j"${CORES}" tests-radio
169 if [[ " X9E X9 ALL " =~ \ ${FLAVOR}\ ]] ; then
170 # OpenTX on Taranis X9E
171 rm -rf ./*
172 cmake "${COMMON_OPTIONS}" -DPCB=X9E -DHELI=YES -DLUA=YES -DGVARS=YES -DPPM_UNIT=PERCENT_PREC1 "${SRCDIR}"
173 make -j"${CORES}" ${FIRMARE_TARGET}
174 make -j"${CORES}" libsimulator
175 make -j"${CORES}" tests-radio
178 if [[ " X10 COLORLCD ALL " =~ \ ${FLAVOR}\ ]] ; then
179 # OpenTX on X10 boards
180 rm -rf ./*
181 cmake "${COMMON_OPTIONS}" -DPCB=X10 -DHELI=YES -DLUA=YES -DGVARS=YES "${SRCDIR}"
182 make -j"${CORES}" ${FIRMARE_TARGET}
183 make -j"${CORES}" libsimulator
184 make -j"${CORES}" tests-radio
187 if [[ " X12S COLORLCD ALL " =~ \ ${FLAVOR}\ ]] ; then
188 # OpenTX on X12S
189 rm -rf ./*
190 cmake "${COMMON_OPTIONS}" -DPCB=X12S -DHELI=YES -DLUA=YES -DGVARS=YES "${SRCDIR}"
191 make -j"${CORES}" ${FIRMARE_TARGET}
192 make -j"${CORES}" libsimulator
193 make -j"${CORES}" tests-radio
196 if [[ " COMPANION ALL " =~ \ ${FLAVOR}\ ]] ; then
197 # Companion
198 rm -rf ./*
199 cmake "${COMMON_OPTIONS}" "${SRCDIR}"
200 make -j"${CORES}" companion23 simulator23
201 make -j"${CORES}" tests-companion