mem.sh with more than one target
This commit is contained in:
parent
a269e26c0d
commit
38991084a5
3 changed files with 85 additions and 63 deletions
|
|
@ -73,7 +73,7 @@ RUN make
|
||||||
RUN make install
|
RUN make install
|
||||||
|
|
||||||
# Build and install the clixon example
|
# Build and install the clixon example
|
||||||
WORKDIR /clixon/clixon/example
|
WORKDIR /clixon/clixon/example/main
|
||||||
RUN make
|
RUN make
|
||||||
RUN make install
|
RUN make install
|
||||||
RUN install example.xml /clixon/build/etc/clixon.xml
|
RUN install example.xml /clixon/build/etc/clixon.xml
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,10 @@ Run all tests but continue after errors and only print a summary test output ide
|
||||||
```
|
```
|
||||||
|
|
||||||
## Memory leak test
|
## Memory leak test
|
||||||
These tests use valgrind to check for memory leaks:
|
The `mem.sh` runs memory checks using valgrind. Start it with no arguments to test all components (backend, restconf, cli, netconf), or specify which components to run:
|
||||||
```
|
```
|
||||||
mem.sh cli
|
mem.sh # All components
|
||||||
mem.sh netconf
|
mem.sh restconf backend # Only backend and cli
|
||||||
mem.sh backend
|
|
||||||
mem.sh restconf
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Site.sh
|
## Site.sh
|
||||||
|
|
|
||||||
38
test/mem.sh
38
test/mem.sh
|
|
@ -1,17 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Run valgrind leak test for cli, restconf, netconf or background.
|
# Run valgrind leak test for cli, restconf, netconf or background.
|
||||||
# Stop on first error
|
# Stop on first error
|
||||||
#
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "usage: $0 cli|netconf|restconf|backend" # valgrind memleak checks
|
# Run valgrindtest once, args:
|
||||||
exit -1
|
# what: cli|netconf|restconf|backend
|
||||||
fi
|
memonce(){
|
||||||
PROGRAM=$1
|
what=$1
|
||||||
|
|
||||||
valgrindfile=$(mktemp)
|
valgrindfile=$(mktemp)
|
||||||
echo "valgrindfile:$valgrindfile"
|
echo "valgrindfile:$valgrindfile"
|
||||||
|
|
||||||
case "$PROGRAM" in
|
case "$what" in
|
||||||
'cli')
|
'cli')
|
||||||
valgrindtest=1
|
valgrindtest=1
|
||||||
RCWAIT=1
|
RCWAIT=1
|
||||||
|
|
@ -48,6 +48,7 @@ esac
|
||||||
err=0
|
err=0
|
||||||
testnr=0
|
testnr=0
|
||||||
for test in test_*.sh; do
|
for test in test_*.sh; do
|
||||||
|
if [ $testnr != 0 ]; then echo; fi
|
||||||
testfile=$test
|
testfile=$test
|
||||||
. ./$test
|
. ./$test
|
||||||
errcode=$?
|
errcode=$?
|
||||||
|
|
@ -62,4 +63,27 @@ if [ $valgrindtest -eq 1 ]; then
|
||||||
checkvalgrind
|
checkvalgrind
|
||||||
sudo rm -f $valgrindfile
|
sudo rm -f $valgrindfile
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$*" ]; then
|
||||||
|
cmds="backend restconf cli netconf"
|
||||||
|
else
|
||||||
|
cmds=$*
|
||||||
|
fi
|
||||||
|
|
||||||
|
# First run sanity
|
||||||
|
for c in $cmds; do
|
||||||
|
if [ $c != cli -a $c != netconf -a $c != restconf -a $c != backend ]; then
|
||||||
|
echo "c:$c"
|
||||||
|
echo "usage: $0 [cli|netconf|restconf|backend]+"
|
||||||
|
echo " with no args run all"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Then actual run
|
||||||
|
for c in $cmds; do
|
||||||
|
echo "Mem test for $c"
|
||||||
|
echo "================="
|
||||||
|
memonce $c
|
||||||
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue