runtest.sh: Bugfix cfg dir when run in test/cfg (#1311)

Commit 5cc8da2db4 introduced syntax checking of xml-files. This broke
running the file directly in the test/cfg folder since it assumed the
config files to check were located in cfg in the current working
directory. Fix this by adding a variable that holds the correct path.
This commit is contained in:
rikardfalkeborn 2018-07-15 22:24:31 +02:00 committed by Daniel Marjamäki
parent 39857220ce
commit 0e639ea7c9
1 changed files with 3 additions and 1 deletions

View File

@ -5,9 +5,11 @@ set -x # be verbose
if [[ $(pwd) == */test/cfg ]] ; then # we are in test/cfg if [[ $(pwd) == */test/cfg ]] ; then # we are in test/cfg
CPPCHECK="../../cppcheck" CPPCHECK="../../cppcheck"
DIR="" DIR=""
CFG="../../cfg/"
else # assume we are in repo root else # assume we are in repo root
CPPCHECK="./cppcheck" CPPCHECK="./cppcheck"
DIR=test/cfg/ DIR=test/cfg/
CFG="cfg/"
fi fi
# Cppcheck options # Cppcheck options
@ -109,7 +111,7 @@ set -e
if [ $XMLSTARLET_RETURNCODE -ne 0 ]; then if [ $XMLSTARLET_RETURNCODE -ne 0 ]; then
echo "xmlstarlet needed to extract defines, skipping defines check." echo "xmlstarlet needed to extract defines, skipping defines check."
else else
for configfile in cfg/*.cfg; do for configfile in ${CFG}*.cfg; do
echo "Checking defines in $configfile" echo "Checking defines in $configfile"
# Disable debugging output temporarily since there could be many defines # Disable debugging output temporarily since there could be many defines
set +x set +x