check_configtool.sh: allow spaces in paths.
To the best of my bash script knowledge, this also means we have to break on the first error, because pipe terms run in a subshell, so they can't pass variables to the parent.
This commit is contained in:
parent
21ac717d6d
commit
e35fe22f74
|
|
@ -8,31 +8,28 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Create an output directory for verification
|
# Create an output directory for verification
|
||||||
OUTDIR=build/test
|
OUTDIR="build/test"
|
||||||
rm -rf ${OUTDIR}
|
rm -rf "${OUTDIR}"
|
||||||
mkdir -p ${OUTDIR}
|
mkdir -p "${OUTDIR}"
|
||||||
|
|
||||||
EXITCODE=0
|
|
||||||
|
|
||||||
# Check board and printer configurations.
|
# Check board and printer configurations.
|
||||||
for IN in $(git ls-files config/*.h); do
|
git ls-files "config/*.h" | while read IN; do
|
||||||
|
|
||||||
# Use configtool.py to regenerate headers for comparison
|
# Use configtool.py to regenerate headers for comparison
|
||||||
OUT=${OUTDIR}/$(basename ${IN})
|
OUT="${OUTDIR}"/$(basename "${IN}")
|
||||||
./configtool.py --load=${IN} --save=${OUT} --quit
|
./configtool.py --load="${IN}" --save="${OUT}" --quit
|
||||||
|
|
||||||
# Strip the "help text" comments from the source and output files
|
# Strip the "help text" comments from the source and output files
|
||||||
perl -p0i -e 's#/\*.*?\*/##sg' ${OUT}
|
perl -p0i -e 's#/\*.*?\*/##sg' "${OUT}"
|
||||||
perl -p0 -e 's#/\*.*?\*/##sg' ${IN} > ${OUT}.cmp
|
perl -p0 -e 's#/\*.*?\*/##sg' "${IN}" > "${OUT}.cmp"
|
||||||
|
|
||||||
# Fail if the result is different except in whitespace
|
# Fail if the result is different except in whitespace
|
||||||
if ! diff -qBbw ${OUT} ${OUT}.cmp ; then
|
if ! diff -qBbw "${OUT}" "${OUT}.cmp" ; then
|
||||||
echo "Configtool integrity test failed on file ${IN}"
|
echo "Configtool integrity test failed on file ${IN}"
|
||||||
echo " Executed: ./configtool.py --load=${IN} --save=${OUT} --quit"
|
echo " Executed: ./configtool.py --load=\"${IN}\" --save=\"${OUT}\" --quit"
|
||||||
echo " Expected resulting settings to match, but they do not."
|
echo " Expected resulting settings to match, but they do not."
|
||||||
|
|
||||||
diff -Bbw ${OUT} ${OUT}.cmp |sed -e 's/^/ /' || :
|
diff -Bbw "${OUT}" "${OUT}.cmp" | sed -e 's/^/ /' || :
|
||||||
EXITCODE=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
exit ${EXITCODE}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue