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

* Added clicon_socket_set() and clicon_socket_get() functions for cleaning up backend server and restconf FCGI socket on termination.
* Removed obsolete `-x` command-line option to clixon_cli.
This commit is contained in:
Olof Hagsand 2019-02-20 13:05:31 +01:00
parent 28bd698968
commit 6e63f0a77b
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