diff --git a/.travis.yml b/.travis.yml index 97cf8855e..602710390 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index 042af9fed..dc876e7a6 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -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///g') + echo "$EXTRACTED_DEFINES" | gcc -fsyntax-only -xc -Werror - + set -x + done +fi