Added valgrind memory leak tests for backend. Fixed some minor leaks and file descriptor closes.

This commit is contained in:
Olof hagsand 2019-02-19 13:16:59 +01:00
parent add43d250d
commit 4c0b412e9f
34 changed files with 318 additions and 382 deletions

View file

@ -14,32 +14,33 @@ echo "valgrindfile:$valgrindfile"
case "$PROGRAM" in
'cli')
valgrindtest=1
DEMSLEEP=1
RCWAIT=1
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
;;
'netconf')
valgrindtest=1
DEMSLEEP=1
RCWAIT=1
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
;;
# 'backend')
# valgrindtest=2
# DEMSLEEP=20
# clixon_backend="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --trace-children=yes --log-file=$valgrindfile clixon_backend"
#;;
'backend')
valgrindtest=2 # This means backend valgrind test
RCWAIT=10 # valgrind backend needs some time to get up
perfnr=100 # test_perf.sh restconf put more or less stops
perfreq=10
clixon_backend="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
;;
*)
echo "usage: $0 cli|netconf|restconf|backend" # valgrind memleak checks
exit -1
;;
esac
rm -f
err=0
testnr=0
for test in test*.sh; do
for test in test_*.sh; do
testfile=$test
DEMSLEEP=$DEMSLEEP . ./$test
. ./$test
errcode=$?
if [ $errcode -ne 0 ]; then
err=1
@ -47,12 +48,9 @@ for test in test*.sh; do
echo -ne "\e[0m"
exit $errcode
fi
if [ $valgrindtest -eq 2 ]; then
# sudo cat $valgrindfile
sudo checkvalgrind
# sudo rm -f $valgrindfile
fi
done
checkvalgrind
rm -f $valgrindfile
if [ $valgrindtest -eq 1 ]; then
checkvalgrind
sudo rm -f $valgrindfile
fi