cfg/runtests.sh: Check syntax of defines in configuration files. (#1303)
travis: Add xmlstarlet package used by cfg/runtests.sh
This commit is contained in:
parent
086a005a9f
commit
5cc8da2db4
|
@ -39,7 +39,7 @@ matrix:
|
|||
before_install:
|
||||
# install needed deps
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq python-pygments qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common
|
||||
- sudo apt-get install -qq python-pygments qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet
|
||||
|
||||
script:
|
||||
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
|
||||
|
|
|
@ -100,3 +100,25 @@ else
|
|||
fi
|
||||
fi
|
||||
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=gtk -f ${DIR}gtk.c
|
||||
|
||||
# Check the syntax of the defines in the configuration files
|
||||
set +e
|
||||
xmlstarlet --version
|
||||
XMLSTARLET_RETURNCODE=$?
|
||||
set -e
|
||||
if [ $XMLSTARLET_RETURNCODE -ne 0 ]; then
|
||||
echo "xmlstarlet needed to extract defines, skipping defines check."
|
||||
else
|
||||
for configfile in cfg/*.cfg; do
|
||||
echo "Checking defines in $configfile"
|
||||
# Disable debugging output temporarily since there could be many defines
|
||||
set +x
|
||||
# XMLStarlet returns 1 if no elements were found which is no problem here
|
||||
set +e
|
||||
EXTRACTED_DEFINES=$(xmlstarlet sel -t -m '//define' -c . -n <$configfile)
|
||||
set -e
|
||||
EXTRACTED_DEFINES=$(echo "$EXTRACTED_DEFINES" | sed 's/<define name="/#define /g' | sed 's/" value="/ /g' | sed 's/"\/>//g')
|
||||
echo "$EXTRACTED_DEFINES" | gcc -fsyntax-only -xc -Werror -
|
||||
set -x
|
||||
done
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue