Files
espurna/code/test_build.sh
Max Prokhorov d0a137ce94 Test: move travis boards outside of hardware header (#1943)
* travis: move build flags tests outside of hardware header

* mqtt: fix typo

* travis: use files instead of bundling test cases into script

* fixup! travis: use files instead of bundling test cases into script

* fix variable expansion, remove custom h at the end

* add ade7953 to sensors list

* custom.h path as variable

* shellcheck

* fix printf syntax, silent again

* fix bash 4.3 treating empty array as unset variable
2019-10-16 14:23:19 +03:00

40 lines
886 B
Bash
Executable File

#!/bin/bash
set -eu -o pipefail
CUSTOM_HEADER="espurna/config/custom.h"
TARGET_ENVIRONMENT=${1:?"pio env name"}
shift 1
CONFIGURATIONS=(
basic
sensor
emon
light_my92xx
light_dimmer
nondefault
)
if [ $# > 0 ] ; then
CONFIGURATIONS=("${CONFIGURATIONS[@]}" "$@")
fi
trap 'rm -f ${CUSTOM_HEADER}' EXIT
for cfg in "${CONFIGURATIONS[@]}" ; do
echo "travis_fold:start:build_${cfg}"
echo "- building ${cfg}"
printf "#define MANUFACTURER \"%s\"\n" "TEST_BUILD" \
| tee ${CUSTOM_HEADER}
printf "#define DEVICE \"%s\"\n" "${cfg^^}" \
| tee --append ${CUSTOM_HEADER}
tee --append ${CUSTOM_HEADER} < "test/build/${cfg}.h"
export PLATFORMIO_SRC_BUILD_FLAGS="-DUSE_CUSTOM_H"
export PLATFORMIO_BUILD_CACHE_DIR="test/pio_cache"
time pio run -s -e "$TARGET_ENVIRONMENT"
echo "travis_fold:end:build_${cfg}"
done