kopia lustrzana https://github.com/espressif/esp-idf
CI build_examples.sh: Fail on warnings, even with -Wno-error
rodzic
bd20288b81
commit
1613c180e0
|
@ -12,24 +12,42 @@
|
||||||
EXAMPLE_NUM=1
|
EXAMPLE_NUM=1
|
||||||
RESULT=0
|
RESULT=0
|
||||||
|
|
||||||
|
RESULT_WARNINGS=22 # magic number result code for "warnings found"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
for example in ${IDF_PATH}/examples/*; do
|
for example in ${IDF_PATH}/examples/*; do
|
||||||
[ -f ${example}/Makefile ] || continue
|
[ -f ${example}/Makefile ] || continue
|
||||||
echo "Building ${example} as ${EXAMPLE_NUM}..."
|
echo "Building ${example} as ${EXAMPLE_NUM}..."
|
||||||
mkdir ${EXAMPLE_NUM}
|
mkdir -p example_builds/${EXAMPLE_NUM}
|
||||||
cp -r ${example} ${EXAMPLE_NUM}
|
cp -r ${example} example_builds/${EXAMPLE_NUM}
|
||||||
pushd ${EXAMPLE_NUM}/`basename ${example}`
|
pushd example_builds/${EXAMPLE_NUM}/`basename ${example}`
|
||||||
|
|
||||||
# be stricter in the CI build than the default IDF settings
|
# be stricter in the CI build than the default IDF settings
|
||||||
export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
|
export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
|
||||||
export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
||||||
|
|
||||||
# build non-verbose first, only build verbose if there's an error
|
# build non-verbose first
|
||||||
(make clean defconfig && make all ) || (RESULT=$?; make V=1)
|
BUILDLOG=$(mktemp -t examplebuild.XXXX.log)
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
make clean defconfig
|
||||||
|
make all 2>&1 | tee $BUILDLOG
|
||||||
|
) || (RESULT=$?; make V=1) # only build verbose if there's an error
|
||||||
popd
|
popd
|
||||||
EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
|
EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
|
||||||
|
|
||||||
|
if [ $RESULT -eq 0 ] && grep -q ": warning:" $BUILDLOG; then
|
||||||
|
echo "Build will fail, due to warnings in this example"
|
||||||
|
RESULT=$RESULT_WARNINGS
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f $BUILDLOG
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ $RESULT -eq $RESULT_WARNINGS ]; then
|
||||||
|
echo "Build would have passed, except for warnings."
|
||||||
|
fi
|
||||||
|
|
||||||
exit $RESULT
|
exit $RESULT
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue