mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- unit test has clang analysis.
git-svn-id: file:///svn/unbound/trunk@4901 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
75b8b8c875
commit
635df9c806
3 changed files with 85 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
irregular program stop.
|
irregular program stop.
|
||||||
- Free memory leak in config strlist append.
|
- Free memory leak in config strlist append.
|
||||||
- make sure nsec3 comparison salt is initialized.
|
- make sure nsec3 comparison salt is initialized.
|
||||||
|
- unit test has clang analysis.
|
||||||
|
|
||||||
11 September 2018: Wouter
|
11 September 2018: Wouter
|
||||||
- Fixed unused return value warnings in contrib/fastrpz.patch for
|
- Fixed unused return value warnings in contrib/fastrpz.patch for
|
||||||
|
|
|
||||||
15
testdata/clang-analysis.tdir/clang-analysis.dsc
vendored
Normal file
15
testdata/clang-analysis.tdir/clang-analysis.dsc
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
BaseName: clang-analysis
|
||||||
|
Version: 1.0
|
||||||
|
Description: clang analysis
|
||||||
|
CreationDate: Wed 12 Sep 16:00:26 CEST 2018
|
||||||
|
Maintainer: Wouter Wijngaards
|
||||||
|
Category:
|
||||||
|
Component:
|
||||||
|
Depends:
|
||||||
|
Help:
|
||||||
|
Pre:
|
||||||
|
Post:
|
||||||
|
Test: clang-analysis.test
|
||||||
|
AuxFiles:
|
||||||
|
Passed:
|
||||||
|
Failure:
|
||||||
69
testdata/clang-analysis.tdir/clang-analysis.test
vendored
Normal file
69
testdata/clang-analysis.tdir/clang-analysis.test
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
# #-- clang-analysis.test --#
|
||||||
|
# source the master var file when it's there
|
||||||
|
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||||
|
# use .tpkg.var.test for in test variable passing
|
||||||
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
# common functions
|
||||||
|
. ../common.sh
|
||||||
|
|
||||||
|
if test ! -x "`which clang 2>&1`"; then
|
||||||
|
echo "No clang in path"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
#echo "have clang"
|
||||||
|
|
||||||
|
# read value from Makefile
|
||||||
|
# $1: result variable name
|
||||||
|
# $2: string on Makefile
|
||||||
|
# $3: Makefile location
|
||||||
|
read_value () {
|
||||||
|
x=`grep "$2" $3 | sed -e "s/$2//"`
|
||||||
|
eval $1="'""$x""'"
|
||||||
|
# print what we just read
|
||||||
|
#echo $1"="'"'"`eval echo '$'$1`"'"'
|
||||||
|
}
|
||||||
|
|
||||||
|
PRE="../.."
|
||||||
|
# read some values from the Makefile
|
||||||
|
read_value srcdir '^srcdir=' $PRE/Makefile
|
||||||
|
read_value CPPFLAGS '^CPPFLAGS=' $PRE/Makefile
|
||||||
|
read_value LIBOBJS '^LIBOBJS= *' $PRE/Makefile
|
||||||
|
read_value DNSCRYPT_SRC '^DNSCRYPT_SRC= *' $PRE/Makefile
|
||||||
|
read_value DNSTAP_SRC '^DNSTAP_SRC= *' $PRE/Makefile
|
||||||
|
read_value WITH_PYTHONMODULE '^WITH_PYTHONMODULE= *' $PRE/Makefile
|
||||||
|
read_value WINAPPS '^WINAPPS= *' $PRE/Makefile
|
||||||
|
|
||||||
|
#echo dir is $dir
|
||||||
|
# turn libobjs into C files
|
||||||
|
compatfiles=`echo "$LIBOBJS" | sed -e 's?..LIBOBJDIR.?compat/?g' -e 's/.U.o/.c/g'`
|
||||||
|
#echo compatfiles are $compatfiles
|
||||||
|
#echo
|
||||||
|
if test "$WITH_PYTHONMODULE" = "yes"; then PYTHONMOD_SRC="pythonmod/*.c"; fi
|
||||||
|
if test ! -z "$WINAPPS"; then WIN_SRC="winrc/*.c"; fi
|
||||||
|
|
||||||
|
cd $PRE; cd $srcdir
|
||||||
|
# check the files in the srcdir
|
||||||
|
fail="no"
|
||||||
|
for x in cachedb/*.c daemon/*.c dns64/*.c $DNSCRYPT_SRC $DNSTAP_SRC edns-subnet/*.c ipsecmod/*.c iterator/*.c libunbound/*.c $PYTHONMOD_SRC respip/*.c services/*.c services/*/*.c sldns/*.c smallapp/*.c util/*.c validator/*.c $WIN_SRC $compatfiles testcode/*.c; do
|
||||||
|
if test "$x" = "util/configlexer.c"; then continue; fi
|
||||||
|
if test "$x" = "util/configparser.c"; then continue; fi
|
||||||
|
if test "$x" = "testcode/signit.c"; then continue; fi
|
||||||
|
echo clang --analyze $CPPFLAGS $x
|
||||||
|
plist=`basename $x .c`.plist
|
||||||
|
rm -rf $plist
|
||||||
|
clang --analyze $CPPFLAGS $x 2>&1 | tee tmp.$$
|
||||||
|
if grep -e warning -e error tmp.$$ >/dev/null; then
|
||||||
|
fail="yes"
|
||||||
|
fails="$fails $x"
|
||||||
|
fi
|
||||||
|
rm -rf $plist tmp.$$
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
if test "$fail" = "yes"; then
|
||||||
|
echo "Failures"
|
||||||
|
echo "create reports in file.plist dir with clang --analyze --analyzer-output html $CPPFLAGS""$fails"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "OK"
|
||||||
|
exit 0
|
||||||
Loading…
Reference in a new issue