Revert "Revert "* Added valgrind memory leak tests in testmem.sh for restconf""

This reverts commit a73d2bd242.
This commit is contained in:
Olof hagsand 2019-02-20 16:25:42 +01:00
parent a73d2bd242
commit 83edd29678
29 changed files with 193 additions and 131 deletions

View file

@ -52,8 +52,9 @@ testname=
#
: ${valgrindtest=0}
# Valgrind log file. This is usually removed automatically
: ${valgrindfile=$(mktemp)}
# Valgrind log file. This should be removed automatically. Note that mktemp
# actually creates a file so do not call it by default
#: ${valgrindfile=$(mktemp)}
# If set to 0, override starting of clixon_backend in test (you bring your own)
: ${BE:=1}
@ -135,9 +136,9 @@ start_backend(){
if [ $valgrindtest -eq 2 ]; then
# Start in background since daemon version creates two traces: parent,
# child. If background then only the single relevant.
sudo $clixon_backend -F $* -D $DBG &
sudo $clixon_backend -F -D $DBG $* &
else
sudo $clixon_backend $* -D $DBG
sudo $clixon_backend -D $DBG $*
fi
if [ $? -ne 0 ]; then
err
@ -155,6 +156,22 @@ stop_backend(){
fi
}
start_restconf(){
# Start in background
sudo su -c "$clixon_restconf $RCLOG -D $DBG $*" -s /bin/sh www-data &
if [ $? -ne 0 ]; then
err
fi
}
stop_restconf(){
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $valgrindtest -eq 3 ]; then
sleep 1
checkvalgrind
fi
}
# Increment test number and print a nice string
new(){
if [ $valgrindtest -eq 1 ]; then