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

String error
This reverts commit 6e63f0a77b.
This commit is contained in:
Olof hagsand 2019-02-20 16:19:07 +01:00
parent 5b6bdbfd3a
commit a73d2bd242
29 changed files with 131 additions and 193 deletions

View file

@ -57,7 +57,7 @@ These tests use valgrind to check for memory leaks:
mem.sh cli
mem.sh netconf
mem.sh backend
mem.sh restconf
# mem.sh restconf # NYI
```
## Site.sh

View file

@ -1,12 +1,12 @@
{
supp1
supp2
Memcheck:Leak
match-leak-kinds: reachable
fun:*
fun:_dl_new_object
}
{
supp2
supp3
Memcheck:Leak
match-leak-kinds: reachable
fun:*
@ -14,31 +14,16 @@
fun:expand_dynamic_string_token
}
{
supp3
supp44
Memcheck:Leak
match-leak-kinds: reachable
fun:*
fun:_dlerror_run
}
{
supp4
supp5
Memcheck:Leak
match-leak-kinds: reachable
fun:*
fun:_dl_check_map_versions
}
{
supp5
Memcheck:Leak
match-leak-kinds: reachable
fun:*
fun:*
fun:_dl_map_object
}
{
supp6-fcgi
Memcheck:Leak
match-leak-kinds: reachable
fun:*
fun:OS_LibInit
}

View file

@ -52,9 +52,8 @@ testname=
#
: ${valgrindtest=0}
# Valgrind log file. This should be removed automatically. Note that mktemp
# actually creates a file so do not call it by default
#: ${valgrindfile=$(mktemp)}
# Valgrind log file. This is usually removed automatically
: ${valgrindfile=$(mktemp)}
# If set to 0, override starting of clixon_backend in test (you bring your own)
: ${BE:=1}
@ -136,9 +135,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
@ -156,22 +155,6 @@ 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

View file

@ -15,12 +15,12 @@ case "$PROGRAM" in
'cli')
valgrindtest=1
RCWAIT=1
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
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
RCWAIT=1
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
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 # This means backend valgrind test
@ -28,19 +28,10 @@ case "$PROGRAM" in
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=./valgrind-clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
;;
'restconf')
valgrindtest=3 # This means backend valgrind test
sudo chmod 660 $valgrindfile
sudo chown www-data $valgrindfile
RCWAIT=5 # valgrind restconf needs some time to get up
clixon_restconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile /www-data/clixon_restconf"
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
rm -f $valgrindfile
exit -1
;;
esac

View file

@ -106,7 +106,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf
new "start restconf daemon"
start_restconf -f $cfg -y $fyang
sudo su -c "$clixon_restconf -f $RCLOG $cfg -y $fyang -D $DBG" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -194,7 +194,7 @@ new "netconf validate mandatory"
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -127,7 +127,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -178,7 +178,7 @@ new "guest edit nacm"
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"nacm-example:x": 3}' http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "access denied"}}} '
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -146,7 +146,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
new "start restconf daemon (-a is enable http basic auth)"
start_restconf -f $cfg -- -a
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -207,7 +207,7 @@ new "cli rpc as guest"
expectfn "$clixon_cli -1 -U guest -l o -f $cfg rpc ipv4" 255 "protocol access-denied access denied"
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -142,7 +142,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -272,8 +272,7 @@ expecteq "$(curl -u guest:bar -sS -X GET http://localhost/restconf/data/clixon-e
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -254,7 +254,7 @@ new "default delete list deny"
expecteq "$(curl -u wilma:bar -sS -X DELETE http://localhost/restconf/data/clixon-example:translate=key42)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "default deny"}}} '
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -216,7 +216,7 @@ new "permit-edit-config: guest fail restconf"
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"nacm-example:x": 2}' http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "default deny"}}} '
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -70,7 +70,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
new "start restconf daemon"
start_restconf -f $cfg -y $fyang
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -169,7 +169,7 @@ new "netconf get large leaf-list config"
expecteof "/usr/bin/time -f %e $clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" '^<rpc-reply><data><x xmlns="urn:example:clixon"><c>0</c><c>1</c>'
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -51,7 +51,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf
new "start restconf daemon"
start_restconf -f $cfg
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -265,7 +265,7 @@ if [ -z "$match" ]; then
fi
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -83,7 +83,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
new "start restconf daemon"
start_restconf -f $cfg -y $fyang
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -182,7 +182,7 @@ new "restconf POST type x3"
expectfn 'curl -s -X GET http://localhost/restconf/data/example:types' 0 '{"example:types": {"tint": 42,"tdec64": 42.123,"tbool": false,"tstr": "str"}}'
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -48,7 +48,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf
new "start restconf daemon"
start_restconf -f $cfg
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -149,7 +149,7 @@ new "netconf edit-config missing config should fail"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><target><candidate/></target></edit-config></rpc>]]>]]>' '^<rpc-reply><rpc-error><error-type>application</error-type><error-tag>data-missing</error-tag><error-app-tag>missing-choice</error-app-tag><error-info><missing-choice>edit-content</missing-choice></error-info><error-severity>error</error-severity></rpc-error></rpc-reply>]]>]]>$'
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -118,7 +118,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
new "start restconf daemon"
start_restconf -f $cfg -y $fyang
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
new "waiting"
sleep $RCWAIT
@ -274,7 +274,7 @@ echo "Eg: curl -H \"Accept: text/event-stream\" -s -X GET http://localhost/sub/E
#-----------------
sleep 5
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE

View file

@ -82,10 +82,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
sleep $RCWAIT
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
new "netconf set x in example1"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><candidate/></target><config><x xmlns="urn:example:clixon1">42</x></config></edit-config></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>]]>]]>$'
@ -131,7 +128,7 @@ if [ -z "$match" ]; then
fi
new "Kill restconf daemon"
stop_restconf
sudo pkill -u www-data -f "/www-data/clixon_restconf"
if [ $BE -eq 0 ]; then
exit # BE