Added valgrind memory leak tests in testmem.sh for cli and netconf

This commit is contained in:
Olof hagsand 2019-02-18 16:05:51 +01:00
parent 055b1df80c
commit 286c2ec04f
6 changed files with 140 additions and 31 deletions

View file

@ -1,25 +1,6 @@
# Clixon tests
This directory contains testing code for clixon and the example
application. Assumes setup of http daemon as describe under apps/restonf
- jenkins Directory w Jenkins specific stuff
- travis Directory w Travis specific stuff
- all.sh Run through all tests with detailed output, and stop on first error.
- sum.sh Run though all tests and print summary
- mem.sh Make valgrind
- site.sh Add your site-specific modifications here (see example below)
- test_nacm.sh Auth tests using internal NACM
- test_nacm_ext.sh Auth tests using external NACM (separate file)
- test_nacm_protocol.sh Auth tests for incoming RPC:s
- test_nacm_module_read.sh Auth tests for data node read operations
- test_nacm_module_write.sh Auth tests for data node write operations
- test_cli.sh CLI tests
- test_netconf.sh Netconf tests
- test_restconf.sh Restconf tests
- test_yang.sh Yang tests for constructs not in the example.
- test_leafref.sh Yang leafref tests
- test_datastore.sh Datastore tests
- and many more...
## Overview
Tests called 'test_*.sh' and placed in this directory will be
automatically run as part of the all.sh, sum.sh tests etc. The scripts need to follow some rules to work properly, such as add this magic line as the first command line in the script, which ensures it works well when started from `all.sh`:
@ -27,6 +8,8 @@ automatically run as part of the all.sh, sum.sh tests etc. The scripts need to f
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
```
## Prerequisites
You need to build and install the clixon utility programs before running the tests as some of the tests rely on them:
```
cd util
@ -38,10 +21,17 @@ You need to start nginx for some of the text. There are instructions in
* If you run systemd: `sudo systemctl start nginx.service`
* The [example](../example/README.md) has instructions
## Prefix variable
You can prefix a test with `BE=0` if you want to run your own backend.
To run with debug flags, use the `DBG=<number>` environment variable.
Other variables include:
* DEMSLEEP Number of seconds to sleep after daemons have started
## Run all tests
You can run an individual test by itself, or run through all tests matching 'test_*.sh' in the directory. Prints test output and stops on first error:
```
all.sh
@ -49,10 +39,18 @@ You can run an individual test by itself, or run through all tests matching 'tes
Run all tests but continue after errors and only print a summary test output identifying which tests succeeded and which failed:
```
all.sh summary
sum.sh
```
Example site.sh file:
## Memory leak test
These tests use valgrind to check for memory leaks:
```
mem.sh cli
mem.sh netconf
```
## Site.sh
You may add your site-specific modifications in a `site.sh` file. Example:
```
# Add your local site specific env variables (or tests) here.
# Add test to this list that you dont want run
@ -65,3 +63,7 @@ Example site.sh file:
IETFRFC=$YANGMODELS/standard/ietf/RFC
```
## See also
The [clixon test container](../docker/system) encapsulates the `all.sh` test in a test container.