Refactor runtests to allow to specify files on command line (#4609)

This commit is contained in:
Rikard Falkeborn 2022-12-03 15:41:11 +01:00 committed by GitHub
parent 0854fda28a
commit 9427fa3c66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 15 deletions

View File

@ -406,9 +406,8 @@ function cppunit_fn {
fi
}
for f in "${DIR}"*.{c,cpp}
do
f=$(basename $f)
function check_file {
f=$(basename $1)
case $f in
boost.cpp)
boost_fn
@ -506,9 +505,19 @@ do
echo "Unhandled file $f"
exit_if_strict
esac
}
function check_files
{
for f in "$@"
do
check_file $f
done
}
# Check the syntax of the defines in the configuration files
function check_defines_syntax
{
if ! xmlstarlet --version; then
echo "xmlstarlet needed to extract defines, skipping defines check."
exit_if_strict
@ -523,5 +532,14 @@ else
echo "$EXTRACTED_DEFINES" | gcc -fsyntax-only -xc -Werror -
done
fi
}
if [ $# -eq 0 ]
then
check_files "${DIR}"*.{c,cpp}
check_defines_syntax
else
check_files "$@"
fi
echo SUCCESS